Last active
August 29, 2015 14:22
-
-
Save aarongarciah/3778d31ac45dd31585d5 to your computer and use it in GitHub Desktop.
Vertical align an inline-block element using parents pseudo element :before or :after. Doesn't matter the height of the parent or the height of the element.
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
#parent { font-size: 0px; } | |
#parent:before { content: ''; display: inline-block; height: 100%; vertical-align: middle; } | |
#element { display: inline-block; vertical-align: middle; font-size: 10px; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment