Odd IE6 Problem with CSS

E

e n | c k m a

This code works on previous sites I have created but on this particular one
it doesn't... I don't quite understand it - it's very freakish. Could you
please let me know if it's the code or if my browser is broken? Thanks.

The problem I am encountering is the use of "margin: auto" for centering the
main div element.

Keep in mind, it works fine in Firebird and I don't see any reason why it
wouldn't work in IE6. The only thing I can think of is that the DOCTYPE is
HTML 4.01 Transitional (and I don't want to change it).

(Also at URL:http://144.132.34.224/strategis/test.html)

HTML:
----------

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Test Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="Images/test.css">
</head>

<body>
<div id="mainFrame">
<table>
<tr>
<td>Hello World!</td>
</tr>
</table>
</div>
</body>
</html>

CSS:
----------

body {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 80%;
}

td {
color: #003366;
border: 1px solid blue;
}

#mainFrame {
margin: auto;
width: 90%;
text-align: center;
border: 1px solid black;
}
 
S

Steve Pugh

e n | c k m a said:
The problem I am encountering is the use of "margin: auto" for centering the
main div element.

Keep in mind, it works fine in Firebird and I don't see any reason why it
wouldn't work in IE6. The only thing I can think of is that the DOCTYPE is
HTML 4.01 Transitional (and I don't want to change it).

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

That doctype triggers quirks mode and in quirks mode IE6 doesn't
center elements via margin: auto.

You can shift it to standards mode by changing the doctype to
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Which is still the same HTML 4.01 Transitional DTD.

If you really can't change the doctype at all, then you'll need to use
another method to center the element in question.

Steve
 
E

e n | c k m a

You can shift it to standards mode by changing the doctype to
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Which is still the same HTML 4.01 Transitional DTD.

It's not exactly the same, unfortunately... well, not in IE6 at least.
If you really can't change the doctype at all, then you'll need to use
another method to center the element in question.

Well if I use another DOCTYPE, it'll require a complete redesign (tables for
layout, etc.) and I don't have the time. I've found another solution,
however, in containing the main div element in another div element and using
align="center"... best I can do for now (without a complete redesign).

Thanks anyway,
Nicko.
 
S

Steve Pugh

e n | c k m a said:
It's not exactly the same, unfortunately... well, not in IE6 at least.

In other words your current code requires quirks mode to display as
you desire in IE6.
Well if I use another DOCTYPE, it'll require a complete redesign (tables for
layout, etc.) and I don't have the time. I've found another solution,
however, in containing the main div element in another div element and using
align="center"... best I can do for now (without a complete redesign).

Exactly, if you use quirks mode then you have to use old fashioned
markup like that.

Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top