Skip to content

Instantly share code, notes, and snippets.

@gcyrillus
Forked from anonymous/dabblet.css
Created May 29, 2013 20:55
Show Gist options
  • Save gcyrillus/5673775 to your computer and use it in GitHub Desktop.
Save gcyrillus/5673775 to your computer and use it in GitHub Desktop.
vertical-horizontal-centering , display through CSS 2.1 or 3 if understood by browser
/* vertical-horizontal-centering , display through CSS 2.1 or 3 if understood by browser
this include I8 and above, opera, FF, Saf, Ch, etc ... */
html,body {
display:table; /* today */
display:flex; /* tomorrow & only for body */
height:100%; /* today & tomorrow */
width:100%; /* today only */
margin:0;}
body {
display:table-cell; /* today */
vertical-align:middle; /* today, no need tomorrow */
display:flex; /* tomorrow */}
p,nav {margin:auto; /* today & tomorow */
border:solid;
display:table; /* today only */
}
/* make up */
nav a {padding:0 1em;box-shadow:0 0 3px;vertical-align:top;background:orange}
a:hover {background:tomato;}
nav:before {content:'Play with font-size and window rezize.';display:table-caption;
position:absolute;margin-top:-1.5em;opacity:0.5;text-shadow:0 0 5px gold;}
<nav>
<a href="#"> link </a>
<a href="#"> link </a>
<a href="#"> link </a>
<a href="#"> link </a>
<a href="#"> link </a>
<a href="#"> link </a>
</nav>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment