CSS:带阴影效果的圆形按钮

我试图复制导航按钮here,这是一个wix网站,因此很难检查元素。CSS:带阴影效果的圆形按钮

我试图在这里

https://jsfiddle.net/1vngy4uo/1/

我想很多变化,从来没有得到CSS 100%正确。

.navButton { 

width:15%;

display:inline-block;

position:relative;

background-color:#03314b;

border-radius: 30%;

box-shadow: 2px 2px 2px #888888;

}

.navButton:hover {

background-color:#98b7c8;

}

.navButton span {

width:100%;

display:inline-block;

position:absolute;

border-radius: 30%;

box-shadow: 2px 2px 2px #888888;

}

.navButton .bg {

height:50%;

top:0;

background-color:#3a6076 ;

border-radius: 30%;

box-shadow: 2px 2px 2px #888888;

}

.navButton:hover .bg{

background-color:#afcad9;

}

.navButton .text {

position:relative;

text-align:center;

color:#fff;

vertical-align: middle;

align-items: center;

}

.navButton .text:hover {

color:#000000;

}

和HTML

<a href="contact.html" class="navButton"> 

<span class="bg"></span>

<span class="text">Contact</span>

回答:

一个非常类似的一个,使用linear-gradient少HTML标记

jsFiddle

.navButton {  

color: white;

text-decoration: none;

font-family: Helvetica, Arial, sans-serif;

font-size: 14px;

text-align: center;

padding: 0 30px;

line-height: 30px;

display: inline-block;

position: relative;

border-radius: 20px;

background-image: linear-gradient(#335b71 45%, #03324c 55%);

box-shadow: 0 2px 2px #888888;

transition: color 0.3s, background-image 0.5s, ease-in-out;

}

.navButton:hover {

background-image: linear-gradient(#b1ccda 49%, #96b4c5 51%);

color: #03324c;

}

<a href="contact.html" class="navButton">Contact</a>

回答:

这将是一个开始?你可能想调整一下颜色。

注:一个可以使用的线性渐变,但它不会在IE9工作,所以我用一个伪代替

.navButton {  

width: 15%;

display: inline-block;

position: relative;

background-color: #03314b;

border-radius: 8px;

box-shadow: 2px 2px 2px #888888;

text-align: center;

text-decoration: none;

color: #fff;

padding: 5px;

transition: all 0.3s;

overflow: hidden;

}

.navButton:before {

content: '';

position: absolute;

top: 0;

left: 0;

height: 50%;

width: 100%;

background-color: #335b71;

transition: all 0.3s;

}

.navButton span {

position: relative;

}

.navButton:hover {

transition: all 0.3s;

background-color: #96b4c5;

color: black;

}

.navButton:hover:before {

transition: all 0.3s;

background-color: #b1ccda;

}

<a href="contact.html" class="navButton">  

<span>Contact</span>

</a>

回答:

我只是用一个div元素实现您提到的相同按钮。这是你想要的吗?

https://jsfiddle.net/9L60y8c6/

<div class="test"> 

</div>

.test {

cursor: pointer;

background: rgba(4, 53, 81, 1) url(//static.parastorage.com/services/skins/2.1212.0/images/wysiwyg/core/themes/base/shiny1button_bg.png) center center repeat-x;

border-radius: 10px;

box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);

transition: background-color 0.4s ease 0s;

position: absolute;

top: 0;

bottom: 0;

left: 5px;

right: 5px;

height: 30px;

width: 115px;

}

以上是 CSS:带阴影效果的圆形按钮 的全部内容, 来源链接: utcz.com/qa/258381.html

回到顶部