Last active
August 29, 2015 14:03
-
-
Save yankeyhotel/24610d72ead860227484 to your computer and use it in GitHub Desktop.
Vertical Align with display:tables
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
.valign-hldr { | |
display: block; | |
height: 100%; | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
} | |
.valign-table { | |
display: table; | |
height: 100%; | |
width: 100%; | |
} | |
.valign-cell { | |
display: table-cell; | |
text-align: center; | |
vertical-align: middle; | |
} |
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
<div class="valign-hldr"> | |
<div class="valign-table"> | |
<div class="valign-cell"> | |
<!-- Content can be anything --> | |
</div> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks to http://css-tricks.com/centering-in-the-unknown