Question : Centered Page CSS

Hi
Im new to CSS and don't know how to do this exactly.

The page should be centered but have a fixed width of 1000px. On the top and bottom there should be 20 px free space. The height is variable depending on the content

------------------------------------
div Title
------------------------------------


div Content



------------------------------------
div navigation
------------------------------------


Could somebody tell me how to do this? I tryed a #container div and then to overlap the other 3 divs buts it's just a mess :(


Answer : Centered Page CSS

Center the body. Add a container to contain the title, content and navigation divs, apply a width to the container and set margins as auto. Set 20px height on the title and navigation.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
body {
 text-align: center;
}

#container {
 width: 1000px;
 margin: auto;
}

#title {
 height: 20px;
}

#navigation {
height: 20px;
}

<div id="container">
 <div id="title"></div>
 <div id="content"></div>
 <div id="navigation"></div>
</div>
Random Solutions  
 
programming4us programming4us