Opera div height bug

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Francois du Toit

    Opera div height bug

    Can someone confirm this:


  • Spartanicus

    #2
    Re: Opera div height bug

    "Francois du Toit" <francoisdutoit @gmail.com> wrote:
    [color=blue]
    >Can someone confirm this:
    >http://www.purpleray.za.net/opera_bug.html[/color]

    The containing block for div.l is div.bug (*not* div.h since it's
    position is static), but div.bug has a height of 100%, which doesn't
    compute to a defined height in your example.

    I'd file a bug @ Mozilla.

    --
    Spartanicus

    Comment

    • Francois du Toit

      #3
      Re: Opera div height bug

      Ok I think I see what you're saying, but what about this:

      In opera you get a red block - and in firefox a blue block. Shouldn't
      div.l inherit the height from div.h ?

      <style type="text/css"><!--
      div.rel {
      background-color: red;
      position: relative;
      left: 10px;
      top: 10px;
      width: 50%;
      }

      div.h {
      height: 100px;
      width: 100%;
      }

      div.l {
      width: 100%;
      height: 100%;
      background-color: blue;
      position: absolute;
      left: 0px;
      top: 0px;
      }

      --></style>
      </head>
      <body>

      <div class="rel">
      <div class="h">
      <div class="l"></div>
      </div>
      </div>

      </body>
      </html>

      Comment

      • Spartanicus

        #4
        Re: Opera div height bug

        "Francois du Toit" <francoisdutoit @gmail.com> wrote:
        [color=blue]
        >Ok I think I see what you're saying, but what about this:
        >
        >In opera you get a red block - and in firefox a blue block. Shouldn't
        >div.l inherit the height from div.h ?[/color]

        No, same reason as with the other example.

        --
        Spartanicus

        Comment

        • Francois du Toit

          #5
          Re: Opera div height bug

          Ok this did not make sence at first, but this is how I understand it
          now. ;)
          Refering to my first example (
          http://www.purpleray.za.net/opera_bug.html )

          The height is not inherited as you said, I misunderstood that. But
          according to the specs from
          http://www.w3.org/TR/REC-CSS2/visude...eight-property :

          <percentage>
          Specifies a percentage height. The percentage is calculated with
          respect to the height of the generated box's containing block. If the
          height of the containing block is not specified explicitly (i.e., it
          depends on content height), the value is interpreted like 'auto'.

          and from
          http://www.w3.org/TR/REC-CSS2/visude...-block-details :

          If the element has 'position: absolute', the containing block is
          established by the nearest ancestor with a 'position' other than
          'static', in the following way:

          So as I understand it - div.l should get it's height from the
          containing block established by div.bug and not div.h because div.h is
          static.
          div.bug's height is a percentage value - but since it's containing
          block is not specified it should get it's height from it's content
          (like auto).

          It seems to me that opera computes the height for div.l from div.l's
          content because it's containing block is not specified (div.bug has a
          percentage value).
          Firefox computes the height for div.l from the containing block of
          div.bug. Although it is not specified, it does have a height that it
          gets from it's content.

          Comment

          • Spartanicus

            #6
            Re: Opera div height bug

            "Francois du Toit" <francoisdutoit @gmail.com> wrote:
            [color=blue]
            >It seems to me that opera computes the height for div.l from div.l's
            >content because it's containing block is not specified (div.bug has a
            >percentage value).[/color]

            Correct, Opera does the right thing here.
            [color=blue]
            >Firefox computes the height for div.l from the containing block of
            >div.bug. Although it is not specified, it does have a height that it
            >gets from it's content.[/color]

            And it's not supposed to do that, Firefox gets this wrong.

            --
            Spartanicus

            Comment

            • Francois du Toit

              #7
              Re: Opera div height bug

              From:


              If the element has 'position: absolute', the containing block is
              established by the nearest ancestor with a 'position' other than
              'static', in the following way:
              1. In the case that the ancestor is block-level, the containing
              block is formed by the padding edge of the ancestor.

              So I think firefox follows the CSS spec correctly.

              More here also:


              Comment

              • Spartanicus

                #8
                Re: Opera div height bug

                "Francois du Toit" <francoisdutoit @gmail.com> wrote:
                [color=blue]
                >From:
                >http://www.w3.org/TR/REC-CSS2/visude...-block-details[/color]

                CSS 2.0 has effectively been obsoleted, use the 2.1 spec. instead.
                [color=blue]
                >If the element has 'position: absolute', the containing block is
                >established by the nearest ancestor with a 'position' other than
                >'static', in the following way:
                > 1. In the case that the ancestor is block-level, the containing
                >block is formed by the padding edge of the ancestor.
                >
                >So I think firefox follows the CSS spec correctly.[/color]

                You've not presented an argument that would support this conclusion, the
                sections that you've quoted from the spec support that Opera is doing
                the right thing.

                If the height of the ancestor of an absolutely positioned box with
                height:100% is undefined, then the height of the absolutely positioned
                box is also undefined and resolves to auto, 100% of undefined is
                undefined.

                The fact that there is another box in between these two boxes with a
                defined height as in your example is irrelevant since it's not the
                containing block for the absolutely positioned element.

                --
                Spartanicus

                Comment

                • Francois du Toit

                  #9
                  Re: Opera div height bug

                  I changed the page a bit to make the problem clearer I hope.

                  The 2.1 spec says roughly the same thing as 2.


                  If the element (div.l) has 'position: absolute', the containing block
                  is established by the nearest ancestor (div.bug) with a 'position' of
                  'absolute', 'relative' or 'fixed', which is the padding edge of the
                  ancestor (if it is block-level).

                  The padding edge of div.bug has a border in my example. This should
                  also be the containing block for div.l .

                  Comment

                  • Gérard Talbot

                    #10
                    Re: Opera div height bug

                    Francois du Toit a écrit :[color=blue]
                    > Ok this did not make sence at first, but this is how I understand it
                    > now. ;)
                    > Refering to my first example (
                    > http://www.purpleray.za.net/opera_bug.html )
                    >
                    > The height is not inherited as you said, I misunderstood that. But
                    > according to the specs from
                    > http://www.w3.org/TR/REC-CSS2/visude...eight-property :
                    >
                    > <percentage>
                    > Specifies a percentage height. The percentage is calculated with
                    > respect to the height of the generated box's containing block. If the
                    > height of the containing block is not specified explicitly (i.e., it
                    > depends on content height), the value is interpreted like 'auto'.
                    >
                    > and from
                    > http://www.w3.org/TR/REC-CSS2/visude...-block-details :
                    >
                    > If the element has 'position: absolute', the containing block is
                    > established by the nearest ancestor with a 'position' other than
                    > 'static', in the following way:
                    >
                    > So as I understand it - div.l should get it's height from the
                    > containing block established by div.bug and not div.h because div.h is
                    > static.
                    > div.bug's height is a percentage value - but since it's containing
                    > block is not specified it should get it's height from it's content
                    > (like auto).
                    >
                    > It seems to me that opera computes the height for div.l from div.l's
                    > content because it's containing block is not specified (div.bug has a
                    > percentage value).
                    > Firefox computes the height for div.l from the containing block of
                    > div.bug. Although it is not specified, it does have a height that it
                    > gets from it's content.
                    >[/color]

                    Opera has had that bug since Opera 7.0 beta 1, some 34 months ago. The
                    bugfile number is 123305 in Opera's BTS.

                    Gérard
                    --
                    remove blah to email me

                    Comment

                    • Spartanicus

                      #11
                      Re: Opera div height bug

                      "Francois du Toit" <francoisdutoit @gmail.com> wrote:
                      [color=blue]
                      >I changed the page a bit to make the problem clearer I hope.[/color]

                      Nope.
                      [color=blue]
                      >The 2.1 spec says roughly the same thing as 2.
                      >http://www.w3.org/TR/CSS21/visudet.h...-block-details
                      >
                      >If the element (div.l) has 'position: absolute', the containing block
                      >is established by the nearest ancestor (div.bug) with a 'position' of
                      >'absolute', 'relative' or 'fixed', which is the padding edge of the
                      >ancestor (if it is block-level).[/color]

                      You continue to repeat this, but there is no disagreement about div.bug
                      being the containing block.

                      You've still not presented an argument for your conclusion that Opera is
                      wrong.

                      --
                      Spartanicus

                      Comment

                      • Francois du Toit

                        #12
                        Re: Opera div height bug

                        >You continue to repeat this, but there is no disagreement about div.bug[color=blue]
                        >being the containing block.[/color]

                        So div.l should have a height of 100% of that containing block which in
                        my example is 200px.
                        [color=blue]
                        >You've still not presented an argument for your conclusion that Opera is
                        >wrong.[/color]

                        The height of div.l is not 200px in opera. It is only as heigh as it's
                        content.
                        The height of div.l is 200px in FF.

                        If that's not clear enough, here is more examples:


                        Comment

                        • Spartanicus

                          #13
                          Re: Opera div height bug

                          "Francois du Toit" <francoisdutoit @gmail.com> wrote:
                          [color=blue][color=green]
                          >>You continue to repeat this, but there is no disagreement about div.bug
                          >>being the containing block.[/color]
                          >
                          >So div.l should have a height of 100% of that containing block which in
                          >my example is 200px.[/color]

                          No it's not, div.bug has an undefined height, again: 100% of undefined
                          is undefined, hence it resolves to auto. The 200px height is specified
                          on the *other* div, which is *not* the containing block. If you want
                          that other div to be the containing block you have to set it's position
                          property to something else than static.
                          [color=blue][color=green]
                          >>You've still not presented an argument for your conclusion that Opera is
                          >>wrong.[/color]
                          >
                          >The height of div.l is not 200px in opera. It is only as heigh as it's
                          >content.
                          >The height of div.l is 200px in FF.[/color]

                          Still no argument, all you are saying is that FF does it differently, so
                          Opera must be wrong.

                          I'm beginning to suspect that you are trolling.

                          --
                          Spartanicus

                          Comment

                          • Martin Bialasinski

                            #14
                            Re: Opera div height bug

                            Spartanicus <invalid@invali d.invalid> wrote:
                            [color=blue]
                            > You've still not presented an argument for your conclusion that
                            > Opera is wrong.[/color]

                            The crucial point is "height: 100%;" in div.bug.

                            Francois thinks it means "100% of its natural height" (inward
                            direction). Which would be 200px in the example.

                            Whereas you say the percentage is to be taken wrt to div.bug's parent
                            element (outward direction). And as its parent has height:auto,
                            div.bug's height is auto. Correct?

                            I think your interpretation of the spec. is the correct
                            one. Percentage height/width is relative to the parent, not the
                            content.

                            An example of the percentage calculations are the typical menus.
                            ul li(width:10em) a(width:100%)


                            Bye,
                            Martin

                            Comment

                            • Martin Bialasinski

                              #15
                              Re: Opera div height bug

                              Gérard Talbot <newsblahgroup@ gtalbot.org> wrote:
                              [color=blue]
                              > Opera has had that bug since Opera 7.0 beta 1, some 34 months
                              > ago. The bugfile number is 123305 in Opera's BTS.[/color]

                              Did you get feedback? Do they agree with you it is an incorrect interpretation?


                              Bye,
                              Martin

                              Comment

                              Working...