View Single Post
    #11 (permalink)  
Old 03-14-2010
The Perfect Word's Avatar
The Perfect Word The Perfect Word is offline
Junior Member
Company name: The Perfect Word
The Perfect Word Transcription: A little bit about?
 
Join Date: Jan 2010
Location: Richmond, Virginia
Posts: 475
Default Re: How do I center a web page??
Originally Posted by Codehead View Post
Here is the secret:
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Centered Page</title>

    <style type="text/css">
        body {
            min-width: 800px;
            text-align: center;
        }
        #main-wrapper {
            width: 800px;
            margin-left: auto;
            margin-right: auto;
            text-align: left;
        }
    </style>
   
</head>

<body>
<div id="main-wrapper">
    I'm a centered page :)
</div>
</body>
</html>

Will this work in HTML 4.01 Transitional?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Also, I'm looking to center the whole webpage on the screen, not center the text. In other words, whatever size monitor you have, your web page will be centered so if you have a really wide screen you won't have a lot of empty space to the right. Does that make sense?
__________________
Pam Deyerle - Transcriptionist in the Richmond, Virginia area
The Perfect Word Transcription Services
Reply With Quote