W3C home > Mailing lists > Public > www-style@w3.org > June 2010

Re: Issue 158 proposed text

From: Tab Atkins Jr. <jackalmage@gmail.com>
Date: Tue, 29 Jun 2010 13:46:07 -0700
Message-ID: <AANLkTim2BKQnO1DaFAZBhMZgVOpMKOO5PXD2UCaBby9H@mail.gmail.com>
To: Bruno Fassino <fassino@gmail.com>
Cc: www-style list <www-style@w3.org>
On Tue, Jun 29, 2010 at 6:37 AM, Bruno Fassino <fassino@gmail.com> wrote:
> Well, this defines "preceding" margins, explicitly excluding margins
> of the element's children.
> So I'm back to one of my original doubts: is it "reasonable" to
> exclude such margins? Not much, in my opinion.
> In something like this:
> <div style="background: yellow">before</div>
> <div style="float: left; height: 50px; width: 100px; background:blue"></div>
> <div style="clear: left">
>        <div style="margin-top: 100px"></div>
> </div>
> <div style="background: yellow">next</div>
> I would prefer to say that the hypothetical position is already 100px
> below the first yellow box, so it stays there and no clearance is
> necessary (which seems to be Firefox's behavior).
> In other words, I would not exclude margins of children collapsing
> with the element's top margin (the rationale for this could be that
> for what concerns the position of the element's top border these
> margins have the same role as the element's top margin. Only the
> element's bottom margin and margins of following siblings have a
> different role and should be excluded.  Of course I'm not sure this
> makes sense :-).

Hmm, maybe.  I see your point - without any clearing at all, the third
div would have 100px of separation from the first div.  With my text,
that space would be eaten, and the third would be flush with the
bottom of the second, only 50px away from the first.

So children are all right.  Bottom margins are not.  That
automatically rules out following siblings as well, since they'll only
collapse if the element's bottom margin collapses with its top.  But
I'm looking at another case where we'd want following siblings to
collapse, or else we'd eat the separation...

[time passes]

I've looked at a few more cases now.  It actually seems that just
going with all adjoining margins is indeed what we want.  The only
problem in all the cases is when the clearing element has no content,
so that its top and bottom margins are adjoining.  Any other element
being self-adjoining is fine, it's the clearing element specifically
that causes problems in everything I've looked at so far.

There are two ways we can deal with this.  The simplest is to just
ignore the problems that self-adjoining clearing elements cause.  The
behavior in that case is well-defined, it's just not ideal.  The less
simple solution is to say that margins collapse as normal, but the
clearing element itself is prevented from being self-adjoining.  As
far as I can tell, this adequately resolves all the cases I've that
have been given in the thread, and some variations that I've come up
with myself.

If we choose the second option, the first paragraph of that section
would instead look like this:

| Computing the clearance of an element on which 'clear' is set is
| done by first determining the hypothetical position of the element's
| top border edge within its parent block.  This position is
| determined after the top margin of the element has been collapsed
| with all appropriate adjoining margins per normal margin-collapse
| rules, except that the clearing element's top margin is not allowed
| to collapse with the clearing element's bottom margin.

I don't have any particular opinion on this.  Implementors?

Received on Tuesday, 29 June 2010 20:46:59 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:38:36 UTC