Skip to content

Instantly share code, notes, and snippets.

@emersion
Created January 15, 2016 11:22
Show Gist options
  • Select an option

  • Save emersion/dbed407b5561cb5df258 to your computer and use it in GitHub Desktop.

Select an option

Save emersion/dbed407b5561cb5df258 to your computer and use it in GitHub Desktop.
Vertical align class
<div class="valign" style="height: 500px;">
<div>
Hi!<br>
My name is... JOHN CENA!!1
</div>
</div>
.valign {
font-size: 0;
}
.valign::before {
content: " ";
display: inline-block;
vertical-align: middle;
height: 100%;
width: 0;
}
.valign > * {
display: inline-block;
vertical-align: middle;
font-size: normal;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment