老规矩,先放图片效果图:
这个效果实现原理很简单:只要你掌握css3动画和过渡相关知识就行,不用js代码;
HTML代码:
<div>
<ul id="list">
<li >
<a href="">国际美妆抢先看</a>
<img src="images/1.jpg" />
</li>
<li>
<a href="">女神标准大讨论</a>
<img src="images/2.jpg" />
</li>
<li class="select">
<a href="">吃货也能越吃越瘦</a>
<img src="images/3.jpg" />
</li>
<li>
<a href="">连衣裙抢头条</a>
<img src="images/4.jpg" />
</li>
<li>
<a href="">宫三女主美妆对决</a>
<img src="images/5.jpg" />
</li>
</ul>
</div>
CSS代码:
*{ margin:0;padding:0; }
ul{ list-style:none; }
a{ font-size:16px;text-decoration:none;color:#666; }
div{ width:300px;margin:20px auto; }
#list li{ line-height:40px;height:40px;background:#efefef;text-indent:1em; margin-bottom:3px;overflow:hidden;-webkit-transition:height 0.3s ease;-moz-transition:height 0.3s ease-ms-transition:height 0.3s ease;-o-transition:height 0.3s ease;transition:height 0.3s ease;}
#list li img{ width:300px;height:200px;}
#list li:nth-child(1){height:240px;background:#F36;}
#list li:nth-child(1) a{ color:#fff; }
#list:hover li{ height:40px;background:#efefef; }
#list:hover li a{color:#666;}
#list li:hover{ height:240px; background:#F36;}
#list li:hover a{ color:#fff; }