DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
The Simplest Way To Horizontally And Vertically Center A DIV Using CSS
//to put the 100px * 100px div in the center of the screen, often used for login or thickbox.
.centered_div {
width: 100px;
height: 100px;
position: absolute;
top: 50%;
left: 50%;
margin-left: -50px; /*half of width*/
margin-top: -50px; /*half of height*/
background: red;
}





