Loading ...
Sorry, an error occurred while loading the content.

CSS Div Width

Expand Messages
  • wilkinsonm
    With IE6 I m getting unexpected results when using CSS to set the height and width of a . When using a strict !DOCTYPE declaration I expected the width
    Message 1 of 4 , Nov 6, 2003
    • 0 Attachment
      With IE6 I'm getting unexpected results when using CSS to set the
      height and width of a <div>. When using a "strict" !DOCTYPE
      declaration I expected the width to be just the width of
      the "content." Instead, I am getting the width of the content plus
      the width of the border and padding.

      I am using this at the beginning of my file:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE html
      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

      <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

      Here's an example of the problem:

      <div style="width:500px; border: 5px solid black">blah, blah,
      blah</div>

      I expected the width from the outside edges of the borders to be
      510px in this case. Instead, I am getting 500px.

      Suggestions?

      TIA

      Mike Wilkinson
    • loro
      ... It s the XML declaration. *Anything* before the doctype puts IE6 in Quirks Mode. The XML declaration also
      Message 2 of 4 , Nov 6, 2003
      • 0 Attachment
        wilkinsonm wrote:

        >With IE6 I'm getting unexpected results when using CSS to set the
        >height and width of a <div>. When using a "strict" !DOCTYPE
        >declaration I expected the width to be just the width of
        >the "content." Instead, I am getting the width of the content plus
        >the width of the border and padding.

        >I am using this at the beginning of my file:

        ><?xml version="1.0" encoding="UTF-8"?>
        ><!DOCTYPE html
        > PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

        It's the XML declaration. *Anything* before the doctype puts IE6 in Quirks Mode.
        <http://www.hut.fi/u/hsivonen/doctype.html>

        The XML declaration also triggers Quirks Mode in early versions of Opera 7 btw. They later came to their senses and removed this and some other IE bug mimicry.

        Lotta
      • wilkinsonm
        ... Quirks Mode. ... Hey Lotta - Thanks! Now there s only one problem. If I remove the XML declaration the w3.org validation service doesn t work. It can t
        Message 3 of 4 , Nov 6, 2003
        • 0 Attachment
          --- In ntb-html@yahoogroups.com, loro <loro-spam01-@t...> wrote:

          > It's the XML declaration. *Anything* before the doctype puts IE6 in
          Quirks Mode.
          > <http://www.hut.fi/u/hsivonen/doctype.html>
          >

          Hey Lotta - Thanks!

          Now there's only one problem. If I remove the XML declaration the
          w3.org validation service doesn't work. It can't decide what kind of
          document I have. I even tried putting the declaration after the
          doctype, but no joy. Is there any standards-compliant solution or do I
          just grin and pretend I know what I'm doing?

          TIA - Mike
        • loro
          ... You are welcome Mike. ;-) It should work since this is what most people do. Or do you mean that the validator can t detect a character encoding? Make sure
          Message 4 of 4 , Nov 6, 2003
          • 0 Attachment
            >Hey Lotta - Thanks!
            >
            >Now there's only one problem. If I remove the XML declaration the
            >w3.org validation service doesn't work. It can't decide what kind of
            >document I have. I even tried putting the declaration after the
            >doctype, but no joy. Is there any standards-compliant solution or do I
            >just grin and pretend I know what I'm doing?

            You are welcome Mike. ;-)

            It should work since this is what most people do. Or do you mean that the validator can't detect a character encoding? Make sure the server sends UTF-8 and if you upload a local file slap a meta tag in or use the validator's "extended interface" and the encoding drop-down box.

            Or just revert to HTML since that's how browsers will handle it anyway. :-o

            Lotta
          Your message has been successfully submitted and would be delivered to recipients shortly.