Re: [CSS21] Collapsing Margins

On Wed, Sep 10, 2008 at 8:26 AM, Alex Mogilevsky wrote:
> Actually no, I'll have to take that back. IE8 is correct
>
> The expected behavior is as follows
>
> * "outer" has min-height of 21px
> * "inner" is 20px tall, therefore "outer" would be at most 20px tall if not for min-height, which means "inner" bottom margin doesn't collapse with "outer" bottom margin
> * Since "inner" bottom margin doesn't collapse with the parent, it contributes to the height of the parent
> * "outer" height therefore must be 100px
> * "green" div then is positioned at 100px
>
> Firefox doesn't include "inner" bottom margin into "outer" height.
> Opera and Safari are 1 pixel off. Not sure why.
> IE8 has correct layout.


The point where I'm not sure to agree is:

> * Since "inner" bottom margin doesn't collapse with the parent, it contributes to the height of the parent


If I follow the specs at 10.7 to determine the height of the parent
("outer"), I don't see that the bottom margin of the child ("inner")
should contribute to the height of the parent. Rather it should simply
be ignored (as Firefox does).
Indeed the specs at 10.7 say (3rd point at the end) that when
'min-height' is in effect, the rules for height computing must be
applied again with the value of min-height as the computed value for
height, so as if height were no more 'auto', so ignoring children.
If this reading is correct, then IE8 is not.


-- 
Bruno Fassino http://www.brunildo.org/test

Received on Wednesday, 10 September 2008 07:20:40 UTC