[css-break] what happens to block margins that aren't between block-level boxes? · Issue #3073 · w3c/csswg-drafts (original) (raw)

Comments

@dbaron

There's a section of the spec that defines what happens to block margins that are between block level boxes:

When an unforced break occurs between block-level boxes, any margins adjoining the break truncate to the remaining fragmentainer extent before the break, and are truncated to zero after the break. When a forced break occurs there, adjoining margins before the break are truncated, but margins after the break are preserved. Cloned margins are always truncated to zero on block-level margins.

But what about margins that aren't between block level boxes, such as a margin-block-start of the first child of a block formatting context (BFC), or a margin-block-end of the last child of a BFC?

Also see bug 1487927 about how this relates to column-balancing inside of a multicol... in interesting ways.

@fantasai

@fantasai

Wrt sibling boxes, I think the multicol balancing case wasn't really thought through on this point... Probably the margin should be truncated to zero both before and after an unforced break. I'm uncertain what should happen with a forced break though... Probably the margin should count as content on the earlier fragmentainer for the purpose of balancing, but should be allowed to truncate if the fragmentainer height is too short to include the margin.

@fantasai

Proposal: treat these margins exactly like margins between siblings, i.e. margins before/after an unforced break are truncated to zero, margins after a forced break are preserved, and margins before a forced break are truncated.

@dbaron Does that make sense to you?

@fantasai

(@dauwhe says this makes sense to him, fwiw.)

@dbaron

It's not entirely clear to me what will happen in all the balancing cases; it might produce some surprising results. I guess truncation is at least well-defined in that moving content from one column to another will not cause the column losing content to grow or cause the column gaining content to shrink... at least as long as there aren't negative margins.

(I think the author of this testcase wasn't expecting any truncation, though, and was expecting margins to continue across multiple columns. I guess my original concern wasn't really a fundamental problem, but rather the violation of expectations.)

@rachelandrew

I think web authors probably won't expect truncation, however I think @fantasai's proposal will give the most pleasing results ultimately, and if the behaviour is well defined and can be explained (and is consistent cross-browser) then I think it works.

@fantasai

@dbaron Wrt the author of the testcase not expecting truncation... truncation is what currently happens if you break between siblings, so I think it would be more surprising if it didn't happen after the last child?

@css-meeting-bot

The CSS Working Group just discussed what happens to block margins that aren't between block-level boxes?, and agreed to the following:

@mstensho

fantasai added a commit that referenced this issue

Nov 14, 2018

@fantasai

@fantasai

Edits committed. @mstensho / @dbaron can I get a review? :) I'll submit for republication once you sign off on the edits.

@mstensho