Skip to content

Instantly share code, notes, and snippets.

@ramsesoriginal
Created March 12, 2012 15:03
Show Gist options
  • Save ramsesoriginal/2022502 to your computer and use it in GitHub Desktop.
Save ramsesoriginal/2022502 to your computer and use it in GitHub Desktop.
horizontal + vertical centering
/**
* horizontal + vertical centering
*/
html, body {
height: 100%;
padding:0;
margin:0;
}
.centerme{
position: absolute;
top: 0;
bottom:0;
left:0;
right:0;
padding-top:25%;
padding-left:50%;
display: inline-block;
}
<!-- content to be placed inside <body>…</body> -->
<div class="centerme">
test
</div>
{"view":"split","seethrough":"","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment