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.
精彩评论