Created
November 17, 2013 14:36
-
-
Save avclark/7514123 to your computer and use it in GitHub Desktop.
Vertically center block 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
// We use this to vertically center block elements | |
.vertical-center { | |
&:before { | |
content: ''; | |
display: inline-block; | |
height: 100%; | |
vertical-align: middle; | |
margin-right: -0.25em; /* Adjusts for spacing */ | |
} | |
div { | |
display: inline-block; | |
vertical-align: middle; | |
width: auto; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment