Created
April 26, 2012 05:52
-
-
Save kosmikko/2496348 to your computer and use it in GitHub Desktop.
Vertical centering with Flexbox + margin fallback
This file contains hidden or 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; | |
| } | |
| #wrapper { | |
| /* Make it pretty */ | |
| background: slategray; | |
| text-align: center; | |
| border-radius: .3em; | |
| color: #405060; | |
| font: bold 150% sans-serif; | |
| text-shadow: 0 2px 1px hsla(0,0%,100%,.2); | |
| } | |
| #sidebar { | |
| /* Flexbox hawtness */ | |
| display: box; | |
| display: flexbox; | |
| padding: 1em 1.5em; | |
| background: #bbb; | |
| width: 30%; | |
| } | |
| #main { | |
| padding: 1em 1.5em; | |
| display: box; display: flexbox; | |
| width: 70%; | |
| } |
This file contains hidden or 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 id="wrapper"> | |
| <div id="main">Main content</div> | |
| <div id="sidebar">Sidebar</div> | |
| </div> |
This file contains hidden or 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":"css"} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment