Skip to content

Instantly share code, notes, and snippets.

@avclark
Created November 17, 2013 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avclark/7514123 to your computer and use it in GitHub Desktop.
Save avclark/7514123 to your computer and use it in GitHub Desktop.
Vertically center block elements
// 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