Click to See Complete Forum and Search --> : Centering my page.


trick_daddy
01-29-2006, 07:21 PM
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.

ray326
01-29-2006, 10:54 PM
Got link?

pcthug
01-30-2006, 03:08 AM
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:

<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.

Fang
01-30-2006, 03:15 AM
<!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>