Center div with CSS



Center div with CSS more simple than use javascript, this script work in Safari, Firefox, Chrome and IE.

To use that here the instruction.

1. In html
<div id="center">
<div id="main-content">Center Page</div>
</div>

2. In CSS
div#center {
position:absolute;
width:500px;
height:200px;
top:50%;
left:50%;
margin-top:-100px;
margin-left:-250px;
background-color:#333;
color:#FFF;
}
div#main-content {
padding:15px;
}


That all what you have to do, Cheers....
Official wiyono blog