Forum Moderators: not2easy

Message Too Old, No Replies

content is not centered in Win XP

         

Lorel

1:57 am on Oct 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have designed this site with a Container, then a header which displays the top of background image, then the content area which has the background tiling to the bottom then a box to contain the text which is supposed to provide equal margins on both sides (same as the container/header and content)--but the margins are not working for the box. it looks fine in all browsers on Mac and PC except Win XP where all text in the box is floated to the left edge of the page.

Can anyone see anything wrong here? I have validated the html and css.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="aahfi.css">
<meta name="robots" content="index,follow">
<style type="text/css">
div#container {
width:970px;
margin-top:5px;
margin-left:auto;
margin-right:auto; }
div#content {
width:966px;
margin-left:auto;
margin-right:auto;
background-image: url(images/bgcenter2.gif);
background-repeat: repeat-y; }
div#header {
width:966px;
height:204px;
margin-left:auto;
margin-right:auto;
background-image: url(images/bgtop2.gif);
background-repeat: no-repeat; }
</style>
</head>
<body>

<div id="container">

<div id="content">

<div id="header"><br><br><br>
<div class="menu">
<a href="index.html">Home</a>
<a href="faq.html">FAQ</a>
<a href="contactus.html">Contact Us</a>
</div> <br><br>
<h1>Title Goes Here</h1>
</div>

<div class="box600">
<br><br><br><br><br>
TEXT GOES HERE
<br><br><br><br><br>
</div>

</div><!--end content-->
</div><!--end container-->

</body>
</html>

dreamcatcher

7:05 am on Oct 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it looks fine in all browsers on Mac and PC except Win XP

Did you mean IE?

body {
text-align: center;
}

dc

Lorel

4:50 pm on Oct 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi Dreamcatcher.

Centering text via body only centered the text. I need all content indented, not centered, and thus the need for the box 600 pixels wide. I'm using other box sizes on the page so don't want to have to left align everything.

What I would like to know is what is causing this box600 class to not have equal margins with the 3 IDs mentioned above work fine. Is there a problem with doing this inside an ID?

BTW, I forgot to add this to the style tag above:

.box600 {width:600px;
margin-left:auto;
margin-right:auto; }

[edited by: Lorel at 4:51 pm (utc) on Oct. 15, 2008]

encyclo

4:57 pm on Oct 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's vital to use a "full" doctype when specifying widths and margins in CSS, otherwise you will always experience cross-browser incompatibilities:

FAQ: Choosing the best doctype for your site [webmasterworld.com]