Skip to content

Instantly share code, notes, and snippets.

@brandonpittman
Created May 18, 2014 14:08
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 brandonpittman/573d2478e4a00535e6fc to your computer and use it in GitHub Desktop.
Save brandonpittman/573d2478e4a00535e6fc to your computer and use it in GitHub Desktop.
Vertical center centering with a table
But if you’re using a table for this purpose (and not to display tabular-data), instead you should use another type of element (div, for example), and set its display property to table to mimick a the table behavior.
<style>
.vertical-outer {
display: table;
height: 10em
}
.vertical-inner {
display: table-cell;
vertical-align: middle
}
</style>
<div class="vertical-outer">
<div class="vertical-inner">
<p>I’m so centered it’s not even funny.</p>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment