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-shadow*/
-webkit-box-shadow:0 0 9px #333;
-moz-box-shadow:0 0 9px #333;
box-shadow:0 0 9px #333;
}
}
.green.button, .green.button:visited{
background-color:#91bd09;
}
.green.button:hover{
/*animation-name*/
-webkit-animation-name:greenPulse;
-moz-animation-name:greenPulse;
-ms-animation-name:greenPulse;
-o-animation-name:greenPulse;
animation-name:greenPulse;
}
HTML代码片段
<ul>
<li>
<a class="button magenta super" href="#">按钮</a>
<a class="button green super" href="#">按钮</a>
<a class="button red super" href="#">按钮</a>
<a class="button orange super" href="#">按钮</a>
<a class="button blue super" href="#">按钮</a>
<a class="button yellow super" href="#">按钮</a>
</li>
<li>
<input type="button" class="button magenta super" value="按钮" />
<input type="button" class="button green super" value="按钮" />
<input type="button" class="button red super" value="按钮" />
<input type="button" class="button orange super" value="按钮" />
【CSS3实现漂亮的按钮动画】相关文章:
- oppoR9如何设置桌面天气预报 oppoR9添加天气预报方法
- 蓝魔r10手机报价 蓝魔r10手机评测
- 2016魅族新品魅蓝note3发布会现场视频直播
- 小米5设置主卡方法 小米5如何设置主卡
- 魅蓝note3开启VoLTE的方法 魅蓝note3如何开启VoLTE
- 三星Galaxy A9(A9100)配置怎么样?三星A9高配版配置参数、价格及上市时间详细介绍
- 魅蓝note3怎么装卡?魅蓝note3手机SIM卡安装图文教程
- 魅蓝note3有几种颜色?魅蓝note3哪个颜色好看?
- 三星s7慢动作视频卡顿怎么解决 三星s7慢动作视频录像异常
- 魅蓝note3指纹识别设置图文教程 魅蓝note3指纹识别怎么设置