我想要做的就是使用CSS实现一个从暗色调到明亮色调的过渡效果(使用opacity),我已经尝试过使用-webkit-backface-visibility:hidden的技巧,但它没有起作用。当鼠标悬停时会出现白色闪烁,这让我很烦恼!!
CSS
.button {
margin-left:auto;
margin-right:auto;
margin-top:25px;
display:block;
border-top: 1px solid #96d1f8;
background: #0083d4;
background: -webkit-gradient(linear, left top, left bottom, from(#0099ff), to(#0083d4));
background: -webkit-linear-gradient(top, #0099ff, #0083d4);
background: -moz-linear-gradient(top, #0099ff, #0083d4);
background: -ms-linear-gradient(top, #0099ff, #0083d4);
background: -o-linear-gradient(top, #0099ff, #0083d4);
padding: 5px 10px;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: rgba(0,0,0,1) 0 1px 0;
-moz-box-shadow: rgba(0,0,0,1) 0 1px 0;
box-shadow: rgba(0,0,0,1) 0 1px 0;
text-shadow: rgba(0,0,0,.4) 0 1px 0;
color:#272727;
font-size: 18px;
font-family: 'Century Gothic', Helvetica, Arial, Sans-Serif;
text-decoration: none;
vertical-align: middle;
text-transform:uppercase;
opacity: 1;
transition: all 0.3s ease 0s;
-webkit-backface-visibility: hidden;
-moz-backface-visibility: hidden;
-ms-backface-visibility: hidden;
-o-backface-visibility: hidden;
}
.button:hover {
border-top-color: #28597a;
background: #28597a;
color: #ccc;
opacity: 0.75;
-webkit-backface-visibility: hidden;
}
.button:active {
border-top-color: #1b435e;
background: #1b435e;
-webkit-backface-visibility: hidden;
HTML
<button type="button" onclick="location.href='http://webwavebuilding.com/whatwedo.html'" class="button">Learn more</button>
background: #28597a -ms-linear-gradient(top, #0099ff, #0083d4);
应该可以解决这个问题。 - Jared Farrish