您的位置:首页 > Web前端 > CSS

CSS3小模块hover左右交替互换动画

2013-02-25 10:39 274 查看


<ul class="readers-list">
<li>
<a href="#">
<img src="default.jpg" alt="" />
<em>点头猪</em>
<strong>+10</strong><br />
lilyxue.blogbus.com/
</a>
</li>
<li>
<a href="#">
<img src="default.jpg" alt="" />
<em>点头猪</em>
<strong>+10</strong><br />
lilyxue.blogbus.com/
</a>
</li>
</ul>


*{ margin:0; padding:0; font-size:12px;}
.readers-list{ line-height:18px; overflow:hidden; _zoom:1;}
.readers-list li{ float:left; width:200px; *margin-right:-1px;}
.readers-list a, .readers-list a:hover strong{ background-color:#f2f2f2; background-image:-webkit-linear-gradient(#f8f8f8,#f2f2f2); background-image:-moz-linear-gradient(#f8f8f8,#f2f2f2); background-image:linear-gradient(#f8f8f8,#f2f2f2);}
.readers-list a{ position:relative; display:block; height:36px; margin:4px; padding:4px 4px 4px 44px; color:#999; overflow:hidden; border:1px solid #ccc; border-radius:2px; box-shadow:#eee 0 0 2px;}
.readers-list a:hover{ border-color:#bbb; box-shadow:#ccc 0 0 2px; background-color:#fff; background-image:none;}
.readers-list img, .readers-list em, .readers-list strong{ -webkit-transition:all .2s ease-out; -moz-transition:all .2s ease-out; transition:all .2s ease-out;}
.readers-list img{ float:left; width:36px; height:36px; margin:0 8px 0 -40px; border-radius:2px}
.readers-list a:hover img{ opacity:.6; margin-left:0;}
.readers-list em{ font-style:normal; margin-right:10px;}
.readers-list a:hover em{ color:#EE8B17; font-weight:bold;}
.readers-list strong{ position:absolute; right:6px; top:4px; width:40px; text-align:right; font-size:14px;}
.readers-list a:hover strong{ color:#EE8B17; height:44px; line-height:40px; right:150px; top:0; text-align:center; border-right:1px solid #ccc;}


point:

hover伪类部分定义完第二种效果,关键是给三个对象img em strong增加动画属性transition变换从而实现过渡;

box-shadow:Xoffset Yoffset blur color (inset)

原文转至 详细解说:简单CSS3实现炫酷读者墙
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: