PDA

View Full Version : How To Center A Page Made of Div Layers


Tatious
11-30-2010, 09:04 PM
Hi,

I'm currently making a website for university which I have made using div layers (i have a div layer for the banner, one for my navigation bar and one containing a table for my main content, you can find a basic version of it at sws.canterbury.ac.uk

I need to find a way to center all the content, can anyone help me with this? I tried to make it so that all the content was placed within a table, but, i couldnt get everything looking as slick as i can with div layers

DWcourse
11-30-2010, 10:30 PM
Div layers (or Absolutely positioned divs) are a bad idea for layout which you are only beginning to discover. However you can center your layout by wrapping the entire layout in a div (with ID container) and then setting the div properties as follows:

#container {
position: relative;
margin-left: auto;
margin-right: auto;
}

More info at http://www.dwcourse.com/dreamweaver/centering-a-web-layout.php