Skip to content

Instantly share code, notes, and snippets.

@rustedwolf
Created December 12, 2014 16:39
Show Gist options
  • Save rustedwolf/e895bc43a4cd795fd50e to your computer and use it in GitHub Desktop.
Save rustedwolf/e895bc43a4cd795fd50e to your computer and use it in GitHub Desktop.
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