- From: fantasai <fantasai.lists@inkedblade.net>
- Date: Tue, 30 Nov 2010 19:46:06 -0500
- To: "L. David Baron" <dbaron@dbaron.org>
- CC: public-css-testsuite@w3.org
On 11/24/2010 05:49 PM, L. David Baron wrote:
> I think that this test:
> http://test.csswg.org/suites/css2.1/20101027/html4/margin-collapse-157.htm
> is invalid. As with any margin-collapsing and clear test, it's
> complicated, so I might be missing something.
>
> However, my basic logic is the following:
>
> * the elements with class="clear" all have:
> + clearance above them (below their top margin)
> + border below them
>
> In the bottom row, they also contain an empty element
> (class="empty") with all margins set to 1em. The top and bottom
> margins collapse with each other, but they can't collapse with
> anything outside of the element with class="clear" since they can't
> collapse across the clearance above or the border below. This means
> that the margins of the class="empty" element should take up 1em of
> height below the aqua float (since their parent has clearance) and
> above their parent's bottom border. In this 1em of space, the red
> background of the div with class="clear" should show through.
>
> So I think Gecko's rendering is correct (but, again, I could be
> missing something).
I think what you're missing is that clearance is applied *above* the
top margin of the clearing element, not below it.
From http://www.w3.org/TR/CSS21/visuren.html#clearance
# Clearance inhibits margin collapsing and acts as spacing above
# the margin-top of an element.
From http://www.w3.org/TR/CSS21/box.html#collapsing-margins
# The top margin of an in-flow block box is adjoining to its first
# in-flow block-level child's top margin if the element has no top
# border, no top padding, and the child has no clearance.
^^^^^
Let me know if that clears things up, or if I need to investigate more.
~fantasai
Received on Wednesday, 1 December 2010 08:04:12 UTC