Odd IE6 Problem with CSS

Discussion in 'HTML' started by e n | c k m a, Nov 2, 2003.

  1. 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;
    }
     
    e n | c k m a, Nov 2, 2003
    #1
    1. Advertising

  2. e n | c k m a

    Steve Pugh Guest

    "e n | c k m a" <> wrote:

    >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

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Nov 2, 2003
    #2
    1. Advertising

  3. > 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.
     
    e n | c k m a, Nov 2, 2003
    #3
  4. e n | c k m a

    Steve Pugh Guest

    "e n | c k m a" <> wrote:

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


    In other words your current code requires quirks mode to display as
    you desire in IE6.

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


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

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
     
    Steve Pugh, Nov 2, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ivor O'Connor
    Replies:
    4
    Views:
    850
    Isofarro
    Nov 25, 2003
  2. Peter Mount
    Replies:
    4
    Views:
    951
    Peter Mount
    Jan 31, 2006
  3. Michael Speer

    Odd behavior with odd code

    Michael Speer, Feb 16, 2007, in forum: C Programming
    Replies:
    33
    Views:
    1,103
    Richard Heathfield
    Feb 18, 2007
  4. Pugi!
    Replies:
    0
    Views:
    240
    Pugi!
    Feb 5, 2007
  5. timothytoe
    Replies:
    4
    Views:
    157
Loading...

Share This Page