Skip to content

Instantly share code, notes, and snippets.

@lanche86
Created August 11, 2013 20:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lanche86/6206660 to your computer and use it in GitHub Desktop.
Save lanche86/6206660 to your computer and use it in GitHub Desktop.
Absolute Horizontal And Vertical Centering In CSS
<div>
I am Horizontal and Vertical centered only by CSS!
</div>
/* View Full documentation on: http://codepen.io/shshaw/full/gEiDt */
div {
background: red;
height: 100px;
width: 100px;
top: 0;
right: 0;
bottom: 0;
left: 0;
margin: auto;
position: absolute;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment