开发者

CSS3 transitions with variable heights?

I'm working on a layout that switches a div between two classes, one with a height of 0px. CSS3 animations scale the div height great. The only problem is t开发者_开发技巧hat I want it to scale to the content height, instead of a set height. Is this possible with CSS3 transitions?

Thanks all!


Have you tried to use:

height: auto;

This will change the height based on the content of the container, however if there is nothing in the container then the height will be 0. This is important if you are wanting to use the container with only a background image in it.


Haven't tried this but another poster in another StackOverflow question posted:

You can transition max-height instead: http://jsfiddle.net/leaverou/zwvNY/ - Lea Verou

Let us know if it worked for you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜