1

Is there a way to get a hover effect like the effect on the Google Chrome website (http://www.google.de/intl/de/chrome/browser/) with CSS3 transition? My problem is, that the animation goes into the wrong direction:

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/

4

1 回答 1

3

如果您在正常状态下将填充应用到底部,然后在悬停时移除该填充,您将获得所需的效果。

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 中测试)

于 2013-06-22T13:47:40.503 回答