Skip to content

Instantly share code, notes, and snippets.

@maxw3st
Forked from LeaVerou/dabblet.css
Created December 1, 2012 18:16
Show Gist options
  • Save maxw3st/4183678 to your computer and use it in GitHub Desktop.
Save maxw3st/4183678 to your computer and use it in GitHub Desktop.
Transition to height:auto on replaced elements
/**
* Transition to height:auto on replaced elements
* CSS brain teaser: If transitions to/from height:auto don’t work, why is the height transitioning here?
And why is it not transitioning when it shrinks but only when it grows?
*/
img {
width: 0; height: 0;
transition: 1s linear;
}
div:visited img {
width: 0; height: 0;
transition: 1s linear;
}
div:hover img {
width: 200px; height: auto;
}
<div>
<p>Hover over here</p>
<img src="http://placekitten.com/400/300" />
</div>
// alert('Hello world!');
{"view":"split","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment