是否有一种方法可以获得像谷歌Chrome网站(http://www.google.de/intl/de/chrome/browser/)效果一样的悬停效果与CSS3过渡?我的问题是,动画进入了错误的方向:
HTML:<ul>
<li>Nav#1</li>
<li>Nav#2</li>
<li>Nav#3</li>
</ul>
CSS: ul{ list-style: none; }
ul li{
float: left;
padding: 25px;
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
transition: all 0.4s ease;
}
ul li:hover{ border-bottom: 5px red solid; }
http://jsfiddle.net/HMZKP/如果你在底部的正常状态下应用了填充,然后在鼠标悬停时删除填充,你就会得到想要的效果。
ul li {
float: left;
padding: 25px;
-webkit-transition: all 0.4s ease;
-moz-transition: all 0.4s ease;
-o-transition: all 0.4s ease;
transition: all 0.4s ease;
border-bottom: 0;
padding-bottom: 5px;
}
ul li:hover {
border-bottom: 5px red solid;
padding-bottom: 0;
}
查看此jsfiddle: http://jsfiddle.net/xTjXK/(已在Chrome, Firefox &Safari)