Possible Duplicate:
How to center a div in a div?
I have a big DIV that has a width and height of of 100% so it takes up the whole browser. I also have a another DIV inside that with a width of 1024px and a height of 400px. I was wondering what the best method of centering the div both horizontally and vertically would be? I also want it to stay in the center when the browser is resized. Is there a jQuery plugin, some handy javascript or can I do this simply using CSS.
The Markup
.bigdiv{
height:100%;
width:100%;
background-color:#eee;
}
.smalldiv{
height:400px;
width:1024px;
background-color:#ccc;
}
<div class="bigdiv">
<div class="smalldiv"></div>
</div>
Thanks for any help and advice!