我想这个例子是不言自明的,我不知道为什么 div 首先缩小,然后弹出到正确的高度。
这是示例代码
<div class="block">
<div class="abs">
hover me!!<br/>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet
</div>
</div>
和CSS
.block {
position: relative;
height: 500px;
width: 500px;
}
.abs {
position: absolute;
height: 40px;
width: 200px;
background-color: yellow;
overflow: hidden;
}
.abs:hover { height: auto; transition: height 1s; }
这是一个小提琴链接,内容如下:http://jsfiddle.net/3G7vG/ http://jsfiddle.net/3G7vG/
我在我的 Linux 机器上使用 chromium 版本 31.0.1650.63 Debian jessie/sid (238485) 进行了测试
height:auto
不支持作为 css3 过渡的一部分。
你应该尝试一下min-height
, max-height
, or transform
(使用scalex(aNumberBetweenZeroAndOne)
)
http://jsfiddle.net/LefQV/ http://jsfiddle.net/LefQV/
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)