There are multiple techniques for centering a block element; and the choice for the technique depends on whether you have the size set in percentages or in more absolute values.
Centering an entire page’s contents
body {
text-align: center;
min-width: 500px;
}
#wrapper {
text-align: left;
width: 500px;
margin-left: auto;
margin-right: auto;
}
Commented example
body {
/* MSIE 5 doesn't center based on auto left/right margins,
but 'text-align:center' does center top-level divs: */
text-align: center;
/* Specify a min-width for the body as wide as the 'wrapper'
element itself. This prevents negative (i.e. inaccessible)
left-margins in narrow browser windows when using
Navigator 6+/Mozilla on Win32: */
min-width: 500px;
}
#wrapper {
/* Reset alignment to compensate for ‘text-align:center’: */
text-align: left;
/* Specify the width of the element. This should be the same
as ‘body min-width’: */
width: 500px;
/* Set left and right margins to auto, thus centering the
element in the containing (body) tag: */
margin-left: auto;
margin-right: auto;
}
See also
http://www.bluerobot.com/web/css/center1.html
For more about the centering block element, check out
http://css-discuss.incutio.com/?page=CenteringBlockElement