Created
December 8, 2012 22:30
-
-
Save waldyrious/4242274 to your computer and use it in GitHub Desktop.
Center the contents of a html page
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
html, body { height: 100% /* html also needs height:100% */ } | |
body { | |
display: -moz-box; | |
-moz-box-pack: center; | |
-moz-box-align: center; | |
-moz-box-orient: vertical; | |
display: -webkit-box; | |
-webkit-box-pack: center; | |
-webkit-box-align: center; | |
-webkit-box-orient: vertical; | |
display: box; /* enable box- properties */ | |
box-pack: center; /* center vertically */ | |
box-align: center; /* center horizontally */ | |
box-orient: vertical; /* default is horizontal stacking */ | |
width: 100%; /* display:box makes width collapse */ | |
margin: 0; /* body has a margin by default and will make scrollbars appear */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment