Created
April 20, 2012 00:36
-
-
Save autarc/2425049 to your computer and use it in GitHub Desktop.
Vertical centering with Flexbox + margin fallback
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
/** | |
* Vertical centering with Flexbox + margin fallback | |
* Lea Verou & David Storey | |
*/ | |
html, body { height: 100%; } | |
body { | |
width: 100%; /* needed for FF */ | |
margin: 0; | |
/* Flexbox hawtness */ | |
display: box; display: flexbox; | |
box-align: center; flex-align: center; | |
box-pack: center; flex-pack: center; | |
} | |
div { | |
padding: 1em 1.5em; | |
/* Fallback to look decent w/out Flexbox */ | |
max-width: 10em; | |
margin: 1em auto; | |
} |
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
<img src="http://30.media.tumblr.com/avatar_7331c8ed0527_128.png"><div> |
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
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"html"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment