Skip to content

Instantly share code, notes, and snippets.

@harisrozak
Created March 16, 2015 03:44
Show Gist options
  • Save harisrozak/276eaa03a632cb2abc37 to your computer and use it in GitHub Desktop.
Save harisrozak/276eaa03a632cb2abc37 to your computer and use it in GitHub Desktop.
CSS :: Another way to centering element
.absolute-centering {
width: 200px;
height: 150px;
position: absolute; /* or fixed */
left: 50%;
margin-left: -100px; /* half of width */
top: 50%;
margin-top: -75px; /* half of height */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment