Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Fluid css fold/unfold animation when having auto height
/*
* Credits goes to +RichBradshaw, from whom I've learned this technique
*/
.container .hidden-container {
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease; /* reverse transition*/
/* remember not to put any borders, paddings here*/
}
.container:hover .hidden-container {
max-height: 999px; /* enter bigger value if necessary, but don't over do as it impacts the animation speed! */
transition: max-height 0.5s ease; /* forward transition */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.