How to center With CSS

To center elements relative to their container you can create a DIV tag around the elements and set the following CSS on it:
.centereddiv{
    position: relative;
    margin-left: auto;
    margin-right: auto;
    width: 123px;
}

You do need to specific the with of the div for this to work.

Last updated: 05/06/2006