Skip to content

Instantly share code, notes, and snippets.

Created May 16, 2012 20:27
Show Gist options
  • Save anonymous/2713700 to your computer and use it in GitHub Desktop.
Save anonymous/2713700 to your computer and use it in GitHub Desktop.
Vertical centering with Flexbox + margin fallback
/**
* Vertical centering with Flexbox + margin fallback
* Lea Verou & David Storey
*/
html, body { height: 100%; }
body {
width: 100%; /* needed for FF */
margin: 0;
}
div {
/* Make it pretty */
background: slategray;
text-align: center;
border-radius: .3em;
color: #405060;
text-shadow: 0 2px 1px hsla(0,0%,100%,.2);
line-height: 15px;
font-size: 10px;
padding: 10px
}
<div><h1>
Some text that looks funky maybe
</h1></div>
{"view":"split","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