建站学习网,专业提供各类建站教程,网页素材,SEO资讯等建站资源!

网站模板_网站源码_网站素材_建站教程_建站学习网

当前位置:建站学习网 > DIV+CSS教程 > CSS布局实例 >

CSS3实现漂亮的按钮动画

更新时间:2017-01-08整理编辑:建站学习网阅读:0

 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="按钮" /> 

 

input type="button" class="button blue super" value="按钮" / input type="button" class="button yellow super" value="按钮" / /li /ul
 
 
 


<input type="button" class="button blue super" value="按钮" />
<input type="button" class="button yellow super" value="按钮" />
</li>

 

本文网址:https://www.dedexuexi.com/divcss/bj/2334.html

本站部分文章搜集与网络,如有侵权请联系本站,转载请说明出处。

标签:前端
收藏此文 赞一下!() 打赏本站

如本文对您有帮助,就请建站学习网抽根烟吧!

支付宝打赏
微信打赏
CSS3的一个简单导航栏实现
« 上一篇2017年01月08日
CSS制作网页布局实例:隐藏input文字
2017年01月08日下一篇 »
  • CSS Wave滤镜用法示例
    0阅读
    CSS Wave滤镜可能很多朋友并不喜欢用,其实用的好了,可以有不少奇异效果。CSS Wave滤镜可把对象按垂直方向叠加波形样式,使对象年上去像波浪一样。语法示例:filter:wave(add=add,freq=freq,lightst
  • CSS写的简单表格示例
    0阅读
    使用CSS写表格,不要有所怀疑,主要是对html结构进行css样式重定义,大家可以看看效果图,个人感觉还不错,感兴趣的朋友可以参考下 复制代码 代码如下: !DOCTYPE HTML html head meta http-equiv=Conte
  • 纯CSS代码实现翻页
    0阅读
    !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd html xmlns=http://www.w3.org/1999/xhtml xml:la...
  • 表格列表偶数列、奇数列的CSS样式示例
    0阅读
    表格列表CSS样式包括:偶数列、奇数列、鼠标经过时样式、标题列等等,在接下来的示例中将为大家完美呈现,感兴趣的朋友不要错过 HTML示例源代码: 复制代码 代码如下: table class=list_table
  • 用CSS3创建一个旋转可变色按钮
    0阅读
    先从HTML: div a class=button旋转按钮/a /div 和现在的CSS: .button { background:#aaa; color:#555; font-weight:bold; font-size:15px; padding:10px 15px; border:none...
 
QQ在线咨询