萬盛學電腦網

 萬盛學電腦網 >> 網頁制作 >> DivCSS教程 >> CSS3實現漂亮的按鈕動畫

CSS3實現漂亮的按鈕動畫

 Chrome下效果理想,Firefox,IE9下沒有動畫效果。

CSS代碼片段
.button, .button:visited{
background:#222 url(overlay.png) repeat-x;
display:inline-block;
padding:5px 10px 6px;
color:#fff;
text-decoration:none;
/*border-radius*/
-webkit-border-radius:6px;
-moz-border-radius:6px;
border-radius:6px;
/*box-shadow*/
-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.6);
-moz-box-shadow:0 1px 3px rgba(0,0,0,0.6);
box-shadow:0 1px 3px rgba(0,0,0,0.6);
text-shadow:0 -1px 1px rgba(0,0,0,0.25);
border-bottom:1px solid rgba(0,0,0,0.25);
position:relative;
cursor:pointer;
}
.button:hover{
background-color:#111;
color:#fff;
/*animation-duration*/
-webkit-animation-duration:2s;
-moz-animation-duration:2s;
-ms-animation-duration:2s;
-o-animation-duration:2s;
animation-duration:2s;
/*animation-timing-function*/
-webkit-animation-timing-function:ease-out;
-moz-animation-timing-function:ease-out;
-ms-animation-timing-function:ease-out;
-o-animation-timing-function:ease-out;
animation-timing-function:ease-out;
/*animation-iteration-count*/
-webkit-animation-iteration-count:infinite;
-moz-animation-iteration-count:infinite;
-ms-animation-iteration-count:infinite;
-o-animation-iteration-count:infinite;
animation-iteration-count:infinite;
}
/*定義動畫*/
@-webkit-keyframes greenPulse{
from { background-color:#91bd09;
/*box-shadow*/
-webkit-box-shadow:0 0 9px #333;
-moz-box-shadow:0 0 9px #333;
box-shadow:0 0 9px #333;
}
50%{
background-color:#B4E02C;
/*box-shadow*/
-webkit-box-shadow:0 0 18px #91bd09;
-moz-box-shadow:0 0 18px #91bd09;
box-shadow:0 0 18px #91bd09;
}
to{
background-color:#91bd09;
/*box-sha

copyright © 萬盛學電腦網 all rights reserved