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

It’s an Internet Explorer-exclusive bug wherein an element that is floated – and given a margin in the same direction as the float – ends up with twice the specified margin size. The fix is extremely simple. All you have to do is apply a display: inline rule to your floated element. So you simply go from something like this:
#content {
float: left;
width: 500px;
padding: 10px 15px;
margin-left: 20px;
}
To something like this:
#content {
float: left;
width: 500px;
padding: 10px 15px;
margin-left: 20px;
display: inline;
}
For more about the double margin bug, check out http://www.cssnewbie.com/double-margin-float-bug
Tags: bug fix