|
Answer» I am nearing completion of a website, and cannot remember the code to center the website in the browser window. I am using layers in Dreamweaver 8, and below is the code that I am using, but the website is still aligned on the left when I preview it. The website size is 800 pixels WIDE by 600 pixels tall.
In the past I designed a website very similar to the one I am working on now, and I used Layer 0 as a containment layer (so this is what I am trying to do now).
#Layer0 { position:absolute; left:50%; top:50%; width:800px; height:600px; margin-left:-400px; margin-top:-300px; z-index:0; }
THANKS. This is a problem many people run into.
You NEED to create a seperate DIV around all your page content, just inside the body TAG. Give it an id of "container". Now create a STYLE for that div as follows:
Code: [Select]div#container { width: 100%; }
Then use the following style for your main page content:
Code: [Select]div [???] { width: 800px; margin: auto; }
It's basically setting the margin of your page's content to auto which does it but you need the container div for it to work.
|