Closed Bug 493380 Opened 13 years ago Closed 11 years ago

vertical margins of a clearing element extend to the bottom


(Core :: Layout: Block and Inline, defect)

Not set





(Reporter: crazy-daniel, Unassigned)


(Depends on 1 open bug)


(Keywords: testcase)


(1 file)

369 bytes, text/html
Attached file testcase
I discovered this while working on bug 477462.

If an element has had clearance applied to it, its top and bottom margin collapse and the top margin is smaller than the bottom margin, then a gap of the height (margin-bottom minus margin-top) is rendered.

In the testcase, there should be no gap between the blue square and the green line.
According to my reading of the spec, this is correct behavior. A clearance of 90px (100px - 10px) is necessary to put the _top_ border edge of the "clear" element past the float. 
Then there remain 30px (40px - 10px) of the "clear"'s bottom margin extending _below_ its top border edge, producing the gap.
Blocks: css2.1-tests
Actually, I think they're different.  I'm inclined to think that this one is invalid because of comment 1, and because of this text in the spec (8.3.1):

# If the top and bottom margins of a box are adjoining, then it is possible for
# margins to collapse through it. In this case, the position of the element
# depends on its relationship with the other elements whose margins are being
# collapsed.
#  - If the element's margins are collapsed with its parent's top margin, the
#    top border edge of the box is defined to be the same as the parent's.
#  - Otherwise, either the element's parent is not taking part in the margin
#    collapsing, or only the parent's bottom margin is involved. The position of
#    the element's top border edge is the same as it would have been if the
#    element had a non-zero bottom border.
No longer blocks: css2.1-tests
Closed: 11 years ago
Resolution: --- → INVALID
We should make sure this testcase gets into the CSS 2.1 test suite.
(In reply to comment #4)
> We should make sure this testcase gets into the CSS 2.1 test suite.

Although its primary intent is different, I think it includes the case of this bug: there is a "clear-left" element with margin-bottom greater than margin-top, and the test requires that the part of the margin-bottom exceeding the margin-top has an effect on what follows.
Yes, this bug is invalid. Bruno is correct here.

I haven't found the time yet to make the proper udates to this bug and the related testcases. # Note to myself.
No longer depends on: 50959
You need to log in before you can comment on or make changes to this bug.