Simple Example -- IE 6 or Firefox, Who's Right?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tony LaPaso

    Simple Example -- IE 6 or Firefox, Who's Right?

    Hi All,

    I have a simple style sheet example below and I'm seeing different
    results in IE 6 vs. Firefox 1.0.3. I'm not sure which browser is
    rendering it correctly but I'm tending to think it's IE. In the code
    below you will see two styled <p> elements within the <body> element.

    There are two aspects of the rendering I wanted to ask about.

    First, notice that Firefox simply ignores the "width:500p x" rule
    whereas IE honors it. Why is that? Is IE correct or is Firefox? If you
    change the "display:inline " to "display:bl ock" Firefox *will* honor the
    width.

    Now, if you changed "display:inline " to "display:block" , please change
    it back to "display:inline " before reading the next question.

    The second point I wanted to ask about is the way Firefox chops off the
    upper border. Why is that?

    Thanks very much, I appreciate any helpful replies.

    --
    Tony LaPaso


    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head><title>Te st Page</title>
    <meta http-equiv="content-type" content='text/html; charset="utf-8"'
    />
    </head>

    <body style="backgrou nd-color:green; margin:0; padding:0;">
    <p style='width:50 0px; background-color:white; display:inline;
    border:solid; border-width:10px;'>Th is is the "Home Page
    Header".</p>
    <p style='width:50 0px; background-color:yellow; display:inline;
    border:solid; color:red; border-width:10px;
    padding:0px;'>T his is some simple content.</p>
    </body>
    </html>



  • Steve Pugh

    #2
    Re: Simple Example -- IE 6 or Firefox, Who's Right?

    "Tony LaPaso" <tlapaso@comcas t.net> wrote:
    [color=blue]
    >I have a simple style sheet example below[/color]

    As you put it below your sig separator it won't be included in any
    replies.
    [color=blue]
    > and I'm seeing different
    >results in IE 6 vs. Firefox 1.0.3. I'm not sure which browser is
    >rendering it correctly but I'm tending to think it's IE.[/color]

    Why? IE is almost always wrong when it differs from FF.
    [color=blue]
    >First, notice that Firefox simply ignores the "width:500p x" rule
    >whereas IE honors it. Why is that?[/color]

    width doesn't apply to inline elements.
    [color=blue]
    >Is IE correct or is Firefox?[/color]

    Firefox.
    [color=blue]
    >If you change the "display:inline " to "display:bl ock" Firefox *will*
    >honor the width.[/color]

    Exactly.
    [color=blue]
    >Now, if you changed "display:inline " to "display:block" , please change
    >it back to "display:inline " before reading the next question.
    >
    >The second point I wanted to ask about is the way Firefox chops off the
    >upper border. Why is that?[/color]

    Borders on inline elements are applied after the line boxes are drawn.
    So the first line box is placed at the top of the window as normal and
    then the borders are added. So the borders are drawn off the top of
    the window.

    Steve

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

    Steve Pugh <steve@pugh.net > <http://steve.pugh.net/>

    Comment

    • Beauregard T. Shagnasty

      #3
      Re: Simple Example -- IE 6 or Firefox, Who's Right?

      Tony LaPaso wrote:
      [color=blue]
      > <?xml version="1.0" encoding="utf-8"?>
      > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
      > "DTD/xhtml1-strict.dtd">[/color]

      ...and with the xml prolog above the doctype, IE6 is tossed into quirks
      mode.

      --
      -bts
      -This space intentionally left blank.

      Comment

      • Tony LaPaso

        #4
        Re: Simple Example -- IE 6 or Firefox, Who's Right?

        Steve,

        Thanks for the reply. That clarifies it quite a bit except for one
        thing.
        [color=blue][color=green]
        >>The second point I wanted to ask about is the way Firefox chops off
        >>the
        >>upper border. Why is that?[/color]
        >
        > Borders on inline elements are applied after the line boxes are
        > drawn.
        > So the first line box is placed at the top of the window as normal
        > and
        > then the borders are added. So the borders are drawn off the top of
        > the window.
        >
        > Steve[/color]


        Aren't the "line boxes" you refer to the same as the visual
        manifestation of borders? In other words, for all intents and purposes,
        the "line boxes" *are* the borders (assuming we do not have
        "border:non e"). I don't see why a border should be "draw off the top of
        the window" like this.

        Basically, the "line box" *IS* the border, right? If that's right then
        why should the top border be drawn outside the viewport. What am I
        missing here? Does Meyer's O'Reilly book refer to this?

        Thanks again

        --
        Tony LaPaso


        Comment

        • Tony LaPaso

          #5
          Re: Simple Example -- IE 6 or Firefox, Who's Right?

          Wow, I thought the xml prolog puts it into strict mode (prevents
          quircks mode).

          Thanks.


          --
          Tony LaPaso



          "Beauregard T. Shagnasty" <a.nony.mous@ex ample.invalid> wrote in
          message news:rY9ge.1477 3$eU.8133@twist er.nyroc.rr.com ...[color=blue]
          > Tony LaPaso wrote:
          >[color=green]
          >> <?xml version="1.0" encoding="utf-8"?>
          >> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
          >> "DTD/xhtml1-strict.dtd">[/color]
          >
          > ..and with the xml prolog above the doctype, IE6 is tossed into
          > quirks mode.
          >
          > --
          > -bts
          > -This space intentionally left blank.[/color]


          Comment

          • Martin Bialasinski

            #6
            Re: Simple Example -- IE 6 or Firefox, Who's Right?

            "Tony LaPaso" <tlapaso@comcas t.net> wrote:
            [color=blue]
            > First, notice that Firefox simply ignores the "width:500p x" rule
            > whereas IE honors it. Why is that?[/color]

            Because your document is rendered in quirks mode due to the xml
            prolog. In quirks mode, IE applies width to inline elements, a
            violation of the css specification.
            [color=blue]
            > Is IE correct or is Firefox?[/color]

            Firefox.
            [color=blue]
            > I'm not sure which browser is rendering it
            > correctly but I'm tending to think it's IE.[/color]

            When IE renders something differently from Mozilla and Opera or Safari, it
            is quite a safe bet IE is wrong.
            [color=blue]
            > If you change the "display:inline " to "display:bl ock" Firefox *will*
            > honor the width.[/color]

            Because width applies to block elements.
            [color=blue]
            > The second point I wanted to ask about is the way Firefox chops off the
            > upper border. Why is that?[/color]

            From the CSS specification:

            "Although margins, borders, and padding of non-replaced elements do
            not enter into inline box height calculation (and thus the line box
            calculation), they are still rendered around inline boxes."

            Bye,
            Martin


            Comment

            • Tony LaPaso

              #7
              Re: Simple Example -- IE 6 or Firefox, Who's Right?

              "Martin Bialasinski" <agr30+news@u ni-koeln.de> wrote in message
              news:pan.2005.0 5.11.01.40.42.2 66279@uni-koeln.de...[color=blue]
              > "Tony LaPaso" <tlapaso@comcas t.net> wrote:[color=green]
              >> The second point I wanted to ask about is the way Firefox chops off
              >> the
              >> upper border. Why is that?[/color]
              >
              > From the CSS specification:
              >
              > "Although margins, borders, and padding of non-replaced elements do
              > not enter into inline box height calculation (and thus the line box
              > calculation), they are still rendered around inline boxes."
              >[/color]

              Thank's exactly what I was looking for. Thanks very much.

              --
              Tony LaPaso


              Comment

              • Steve Pugh

                #8
                Re: Simple Example -- IE 6 or Firefox, Who's Right?

                "Tony LaPaso" <tlapaso@comcas t.net> wrote:
                [color=blue][color=green][color=darkred]
                >>>The second point I wanted to ask about is the way Firefox chops off
                >>>the
                >>>upper border. Why is that?[/color]
                >>
                >> Borders on inline elements are applied after the line boxes are
                >> drawn.
                >> So the first line box is placed at the top of the window as normal
                >> and then the borders are added. So the borders are drawn off the top of
                >> the window.[/color]
                >
                >Aren't the "line boxes" you refer to the same as the visual
                >manifestatio n of borders?[/color]

                No. The "line box" is the box that contains one line of text.

                If you had:
                <p>
                Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut felis
                turpis, eleifend sit amet, fermentum non, venenatis commodo, pede.
                Aliquam quis justo id sapien ultricies commodo. Donec libero urna,
                pulvinar sed, auctor vitae,
                <b>
                lacinia sed, elit. Cras condimentum venenatis mi. Vestibulum pede.
                Aliquam erat volutpat. Mauris nec ipsum quis arcu tincidunt auctor.
                </b>
                Maecenas turpis lectus, consequat vel, rutrum sed, pretium nec, justo.
                Integer imperdiet urna quis metus. Donec sit amet mauris sit amet mi
                iaculis congue. Fusce elementum ultricies lorem. Curabitur mollis
                turpis at mauris consequat convallis.
                </p>

                Then this would become a single block box (for the <p> element) and a
                single inline box (for the <b> element) and a varable, depending on
                font size and window width, number of line boxes - one for each line
                of text as displayed by the browser.

                Steve

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

                Steve Pugh <steve@pugh.net > <http://steve.pugh.net/>

                Comment

                Working...