Re: [css3-multicol] margin collapsing between column-spanning element and blocks in column boxes: if, when?

Håkon Wium Lie <howcome@opera.com> writes:

> Morten Stenshorne wrote:
>
>  > >  > >  > One issue that I wish would be explicit and clarified in the spec is if
>  > >  > >  > margin collapsing can occur between a column-spanning element and blocks
>  > >  > >  > in column boxes. If it can occur, then the spec should say so, then define
>  > >  > >  > under which conditions along with an example. If it does not occur, then
>  > >  > >  > the spec should say so.
>  > >  > >
>  > >  > > The answer is: yes, margin collapsing occur as per the normal rules.
>  > >  > > That is, margin collapsing will not to through the content/border box
>  > >  > > of a spanner or a multicol element (both are BFCs), but the margins of
>  > >  > > a spanner will collapse with its surroundings.
>  > >  > 
>  > >  > This has been discussed before, and the opposite conclusion was reached.
>  > >  > 
>  > >  > http://lists.w3.org/Archives/Public/www-style/2010Oct/0774.html
>  > >
>  > > You're right that the two conclusions differ, if not being opposite;
>  > > it seems to make sense that spanner collapse with others spanners and
>  > > its containing block. But not with sibling elements. 
>  > 
>  > Isn't the containing block of a spanner always the multicol container
>  > itself? 
>
> Yes.
>
>  > And since a multicol container establishes a new BFC, its
>  > margins cannot collapse with margins of spanner children.
>
> The example I have in mind is a spanner that naturally appears right
> before or after a page break. Its bottom (or top) margin will be
> "collapsed" with the multicol container.

"Collapse" with the page (or "outer fragmentation context", to be more
precise), not the multicol container, I assume?

> But perhaps "collapsing" isn't the right term, the spec uses
> "truncated":
>   http://dev.w3.org/csswg/css-break/#break-margins

    <div style="columns:3;">
        ....
        <!-- natural page break occurs here -->
        <div style="column-span:all; margin-top:50px;">...</div>
    </div>

You're saying that the 50px top margin should be eaten and forgotten
about when it adjoins a natural/unforced break? I agree.

>  > I think a spanner's margins should only collapse with margins of sibling
>  > spanners, and nothing else.
>
> Yes, modulo the "truncated" case above.

Exactly.

>  > >  > How about this one:
>  > >  > 
>  > >  >         <div style="columns:2; column-rule:solid;">
>  > >  >             <div style="column-span:all; margin-bottom:50px;">spanner</div>
>  > >  >             text
>  > >  >             <div style="break-before:column; margin-top:50px;">x</div>
>  > >  >         </div>
>  > >  > 
>  > >  > I really don't want those two margins to collapse. :)
>  > >
>  > > Agree. They wouldn't if we exclud sibling elements. 
>  > >
>  > > But the second inner DIV (a) could possibly collase with the margins
>  > > of the outer DIV if (a) appears after a natural break.
>  > 
>  > The outer DIV is a multicol container, and multicol containers establish
>  > a new BFC, so they cannot collapse with children, can they? 
>
> Correct, this is expressed in example 12.
>
> I've changed example 27 to say:
>
>   Spanners create new block formatting contexts, but their margins can
>   be changed by their surroundings. In this example, two spanners
>   naturally end up at the top of a page. The top margin of the first
>   spanner is truncated due to being after an unforced break. The
>   bottom margin of the first spanner collapses with the top margin of
>   the second spanner. The bottom margin of the second spanner
>   collapses with the top margin of the subsequent element.
>
> to
>
>   Spanners create new block formatting contexts, but their margins can
>   be changed by their surroundings. In this example, two spanners
>   naturally end up at the top of a page. The top margin of the first
>   spanner is truncated due to being after an unforced break.

That doesn't look like an unforced break; that looks like the FIRST
page. And since there's a blue border preceding the spanner as well,
it's not even at the beginning of the page. So this looks wrong to me.

> The
>   bottom margin of the first spanner collapses with the top margin of
>   the second spanner.

Yes.

> However, the bottom margin of the second spanner
>   does not collabse with the collapses with the top margin of the
>   subsequent element.

If you do an "s/collabse with the collapses/collapse/", I agree here
too. But perhaps the subsequent element should specify a top margin, so
that the example shows this more clearly?

>   http://dev.w3.org/csswg/css-multicol/

-- 
---- Morten Stenshorne, developer, Opera Software ASA ----
------------------ http://www.opera.com/ -----------------

Received on Tuesday, 8 October 2013 06:26:27 UTC