Skip to content

Instantly share code, notes, and snippets.

@marciobarrios
Last active August 29, 2015 13:57
Show Gist options
  • Save marciobarrios/9540430 to your computer and use it in GitHub Desktop.
Save marciobarrios/9540430 to your computer and use it in GitHub Desktop.
Vertical Alignment with CSS
/* For modern browsers (IE9+) */
.valign {
position: relative;
top: 50%;
transform: translateY(-50%);
}
/* Alternative for IE8+, apply to a container of an inline-block element
Ex:
<span class="i-box valign">
<i class="i-powerpoint"></i>
</span>
*/
.valign-fallback:before {
content: "";
height: 100%;
display: inline-block;
vertical-align: middle;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment