-
-
Save maxw3st/4183678 to your computer and use it in GitHub Desktop.
Transition to height:auto on replaced elements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
<p>Hover over here</p> | |
<img src="http://placekitten.com/400/300" /> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// alert('Hello world!'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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