Trying to center a DIV element can be a frustrating experience.
<div id="content"> This is a DIV block that is to be centered. I don't want the text to be centred, though, just the block. </div> |
The trick is to specify a width for the div, then set the left and right margins to auto.
#content { width: 700px ; margin-left: auto ; margin-right: auto ; } |
Just remember, this won't work if you haven't set a width for the
element.