Skip to content

Instantly share code, notes, and snippets.

@pgherveou
Forked from DeviaVir/dabblet.css
Created June 22, 2012 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pgherveou/2971898 to your computer and use it in GitHub Desktop.
Save pgherveou/2971898 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
*/
div {
width: 56px; /* needed for FF */
height: 56px;
font-size: 30px;
border: 1px solid black;
/* Flexbox hawtness */
display: box; display: flexbox;
box-align: center; flex-align: center;
box-pack: center; flex-pack: center;
background-image: linear-gradient(top, rgba(20, 20, 20, 0.5) 0%, rgba(20, 20, 20, 0.5) 50%, rgba(90, 90, 90, 0.5) 50%, rgba(90, 90, 90, 0.5) 100%);
}
<div>×</div>
{"view":"split-vertical","fontsize":"50","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment