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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Centering a webpage 5
Center webpage in browser 3
Resolution Centering 1
Happy Birthday Taffycat! 7
Auto fill not working 2
Imbedded webpage??? 2
"how to center the whole page?' 2
Web Page auto sizeing 6

Back
Top