Fri, 2004-03-05 15:56
I would like to create and center a web page for 800x600 display in a CSS without any tables.
Can anyone recommend the best method for this without using any onload javascript?
Fri, 2004-03-05 16:18
#1
Centering web page with css
Put a div to wrap all content, e.g.:
<div id="wrap">
content
</div>
Then create the style (without my comments):
#wrap {
position: relative;
width: 750px; <----fixed width
height: 430px;
margin: 0px auto; <---- left and right margin is "auto"
}
Sat, 2004-03-06 17:03
#2
Centering web page with css
Thanks, exactly what I needed. Tested and it works beautifully.
Tue, 2004-03-09 16:29
#3
Centering web page with css
As far as I know this only works in standards compliant browsers (Mozilla, etc) but not in IE, surprise surprise. But there are other ways, see:
http://bluerobot.com/web/css/center1.html
http://bluerobot.com/web/css/center2.html