- When we try to make a <ul> slide down using CSS transitions.
- The <ul> starts off at height: 0;. On hover, the height is set to height:auto;. However, this is causing it to simply appear, not transition,
- If we do this from height: 40px; to height: auto;, then it will slide up to height: 0;, and then suddenly jump to the correct height.
How could we do this without using JavaScript?
- The only difference between the two snippets of CSS is one has height: 0, the other height: 40.
- Use max-height in the transformation and not height. And set a value on max-height
- Use max-height with different transition
- HTML
- CSS
;
- Using relative positioning and works on li elements, & is pure CSS
- CSS
- HTML
;
- Transition from height:0 to height:auto
;
- transition max height value:
;
- Set the height to auto and transition the max-height.
;
- A visual workaround to animating height using CSS3 transitions is to animate the padding instead, and to set explicitly height/max-height
;
- Simplified CSS transition height:
;
Transition height using Jquery:
;
- Calculate the max height by getting the height of the inner div using JQuery
- This article provides some of the basic informations on width , max height , window height , height , height auto , how to make height , how to height , css overflow , overflow hidden , min height , window height , overflow auto , max height , text overflow , height , the heights , overflow , height auto , how to make height.
