Re: [csswg-drafts] [css- not sure] child-contain: border-box; to resolve child margins at parents edge

Because other layout systems have different constraints, and the problems are different. ^_^  In particular, margin collapsing and floats end up making it very complex to add the equivalent of 'gap' to block layout, much more so than it is in Flexbox or Grid.  Note that, for example, `child-contain: margin-box` as you describe it is *not* the default value for Block layout; child margins are allowed to "escape" (collapse thru) the parent if the parent has no padding or border, but are "contained" if it does, so it's not just a matter of the child deciding what it wants to do.

Furthermore, the *use cases* of Block layout (laying out text, generally) don't really call for that type of control over separation between children; if that's the sort of thing you need to be doing, you probably want to switch to a layout mode more specialized for your problem, like Flexbox.  Your use-case can be done in Block layout by just setting top/bottom margins on each child, and then setting the top margin to 0 on `:first-child` and bottom to 0 on `:last-child`.  You can't rejigger the order of elements in block layout; you can't have multiple rows of content so that multiple unpredictable elements are bordering the parent (except in multicol, which has some special abilities as a result); these are all things that Flexbox and Grid can do, and that's why we have specialized properties to make it easier to achieve these things there.


-- 
GitHub Notification of comment by tabatkins
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2848#issuecomment-416074843 using your GitHub account

Received on Sunday, 26 August 2018 21:47:49 UTC