www.webdeveloper.com
Results 1 to 4 of 4

Thread: Centering my page.

  1. #1
    Join Date
    Jan 2006
    Posts
    1

    Centering my page.

    Please be gentle.
    I am a begining web developer for my own business and I'm trying to get my website to stop loading first and then centering in the browser. It looks terrible. I would like everything to simply center first and then load.
    Any help would be greatly appreciated.

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    Got link?
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  3. #3
    Join Date
    Oct 2005
    Location
    Gold Coast, Australia
    Posts
    2,115
    What Doctype are you using?
    if a HTML you can put a <center> tag before anything else inside your body, followed by a </center> tag just after the end of your content, however the best practice is to use a Div that is align to the center of the page, here are a couple of examples:
    Code:
    <div align="center">
    Content goes here...
    </div>
    
    ---
    
    <div style="text-align: center">
    Content goes here...
    </div>
    Please note, If your using xhtml the center tag is not valid markup, so a mixture of div's and css must be used.

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title>center contents</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    <style type="text/css">
    <!-- 
    body {
    text-align:center;
    }
    #container {
    margin:0 auto;
    width:80%;
    text-align:left;
    }
    #contents {border:1px solid red;}
    -->
    </style>
    
    </head>
    <body>
    <div id="container">
    	<div id="contents">
       		<p>centered contents</p>
    	</div>
    </div>
    </body>
    </html>
    At least 98% of internet users' DNA is identical to that of chimpanzees

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles