Click to See Complete Forum and Search --> : Align Centre in Firefox?


SuzanneB
08-19-2004, 03:42 AM
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?

Daniel T
08-19-2004, 04:13 AM
In the styles of the item you want to center:margin: 0 auto;

SuzanneB
08-19-2004, 04:42 AM
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. :-(

Fang
08-19-2004, 04:52 AM
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 (http://www.w3.org/QA/2002/04/valid-dtd-list.html)

SuzanneB
08-19-2004, 05:03 AM
THANKS!