how do i auto-center a webpage without tables.

  • Thread starter Thread starter Guest
  • Start date Start date
Using a DIV

<body>
<div id="content">
Content
</div>
</body>

Then the style

body {
background-color: #ccd3d9;
color: #000000;
text-align: center;
}

#content {
width: 630px;
margin-left: auto;
margin-rignt: auto;
border: 2px solid #A6B2BC;
color: #000000;
padding: 0 20px 0 20px;
text-align: left;
}
 
Won't work if there are any absolutely positioned elements in the page. In
that case you'd need to make the div#content "position:relative".

Also, this - > margin-rignt: auto;
should be this - > margin-right: auto;

8)
 
Back
Top