Centering a Page with CSS

by damonp on May 4, 2007

in Snippets

Add this to your stylesheet:

body    {
    text-align: center;
}

div#main    {
    margin: 10px auto;
    width: 600px;  
    text-align: left;
}

Use this for the page body:

<body>
<div id="main">

... main body html ...

</div>
</body>

Popularity: 1%

Most Popular Posts

Damon Parker is a freelance sysadmin and web developer in Texas. He specializes in server setup, server security and high performance server configurations. Need help setting up a web server or getting a server back online after a crash or hack? Email Damon

Leave a Comment

Previous post:

Next post: