- From: Bruno Fassino <fassino@gmail.com>
- Date: Wed, 30 Jun 2010 10:44:34 +0200
- To: "Tab Atkins Jr." <jackalmage@gmail.com>
- Cc: www-style list <www-style@w3.org>
On Tue, Jun 29, 2010 at 10:46 PM, Tab Atkins Jr. <jackalmage@gmail.com> wrote: > 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... In what cases this happens? If clearance "moves" the top border edge and disallows the (possible) collapsing with the parent shouldn't the margins on following siblings always be "reproduced" as expected, even if neglected in the hypothetical position ? > 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. Yes, I agree. All the difficulties arise when the clearing element is "collapsing through". More precisely, in my opinion, there are difficulties only when the clearing element is "collapsing through" and it also collapses with its parent's top. Otherwise, since the element's top border edge is defined (in 8.3.1) "as it would have been if the element had a non-zero bottom border" then the bottom margin and others following are already out of discussion. When there is collapsing with the parent's top, "following" margins affects the position of the element's top border edge and makes more difficult to define a "reasonable" hypothetical position. > 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. Hmm, I'm not sure to agree with: "except that the clearing element's top margin is not allowed to collapse with the clearing element's bottom margin"... Based on what I said before I would rather change that with: "but assuming that the clearing element has a non-zero bottom border" which excludes from the computation of the hypothetical position the clearing element's bottom margin _and_ margins of following siblings. But this is probably different from what you wanted to say. Bruno -- Bruno Fassino http://www.brunildo.org/test
Received on Wednesday, 30 June 2010 08:45:04 UTC