View Full Version : centering a div

08-17-2007, 06:36 AM
Hello everyone,

Does anyone can tell me how to center verticaly a div, in a way that stays in the midle of the browser window, whatever the window´s width?

Thanks in advanced.

08-17-2007, 09:52 AM
Well i saw you asking in my thread how to do it, and now that ive figured it out i can share it , although domedia could probably explain it better.

First make a Div (the one on the left of the AP Div button) now thats going to be the "main" Div, so give it an ID like.. "Main" or something.

Next go into code mode and you should see somewhere near the bottom:

<div id="Whats you called your Div"></div>

Ok you need to change that code to :

<div align="center" id="Whats you called your Div"></div>

Ok that centers the main div, next you need to make a CSS rule for it, so make a rule as follows:

#whateveryoucalledthediv {

Ok almost done, then all you need to do is nest the other Div's you want (these can be AP Div's, inside the main div.)

For more on nesting Div's go to your dreamweaver help and search for:
"Work with nested AP Divs"

Well i hope that helps you, and if anyone else wants to throw in some information please do ;-)


08-17-2007, 01:23 PM
set your margin to auto
#wrapper {
width: 700px;
height: 800px;

08-17-2007, 02:17 PM
plus text-align: center in the for BDOY.
All explained here:

08-17-2007, 02:44 PM
oufff. Finally i got it.
Thanks to all for the help