Align Centre in Firefox?

liunx

Guest
I was using text-align:centre; to get my site central within the IE display area, but in firefox and <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN"> this doesn't work. What does?In the styles of the item you want to center:margin: 0 auto;Oh no! It's doesn't work in "body"? That means I have to add new style to every document to centre a particular item. :-(A full x-browser contents centering:
<!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}
#alignment {text-align: left; margin: auto auto; width:60%;}
p {background:red;}
-->
</style>

</head>
<body>
<div id="alignment">
<p>contents
</p>
</div>
</body>
</html>

Note the valid DTD (<!-- m --><a class="postlink" href="http://www.w3.org/QA/2002/04/valid-dtd-list.html">http://www.w3.org/QA/2002/04/valid-dtd-list.html</a><!-- m -->)THANKS!
 
Back
Top