How to make a "container" div a certain size as well as centre it.

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

If you are all wondering how to create a centred div with a certain
size, as well as a margin, the way I do it is like this:

#container {
    width: 775px;
    background: #fff;
    margin: 1em auto;
    text-align: left;

the WIDTH is for the size of the actual div
background is so then it'll come up at front of the background.
MARGIN is how you center it.  AUTO automatically calculates the size of
the window and centres it in the page.  1em is how much space is
between the DIV and the page itself.  You can set it to 0 if you want.
TEXT-ALIGN is just there to fix the text if something in the CSS has it
set to something like CENTER or RIGHT.

- Mark

P.S.This is just my own knowlege, it's not off of any website.

Site Timeline