Last active
May 7, 2018 13:01
-
-
Save EastSideCode/f881dcdecc22db34351836ef4a8719bc to your computer and use it in GitHub Desktop.
Vertical align floating images the easy way
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
.image-container { | |
height: 200px; /* can be whatever */ | |
} | |
.image-container:before { | |
content: ' '; | |
display: inline-block; | |
vertical-align: middle; | |
height: 100%; | |
} | |
.image-container img { | |
width: 100%; | |
height: auto; | |
display: inline-block; | |
vertical-align: middle; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment