Re: [csswg-drafts] [css-box-3] Should margin-trim apply to flex or grid containers? (#3255)

*Just some thoughts, no real conclusion :)*

My instinct is that it should apply. My main gripe with Grid is precisely how poorly it works as a progressive enhancement over elements that use margin collapsing. It can be very hard to wrangle the margins when they are not set on direct children.

My first thought was that it should apply to both axes. That way `margin-trim: all` could always be used to get a clean slate when using `gap` for spacing.

But thinking about it as simply a solution for dealing with margin collapsing in grid/flex contexts, It might make more sense to just apply it to the block axis, since margin collapsing only works in that direction.

But then wouldn't this:

```css
.grid {
  display: grid;
  margin-trim: all;
}
```

achieve the same result as:

```css
.grid {
  display: grid;
}

.grid > * {
  margin-block-start: 0;
  margin-block-end: 0;
  margin-trim: all;
}
```

So maybe `margin-trim` doesn't really *need* to apply to grid or flex containers, as it wouldn't solve any unsolvable problem 🤷‍♂️

Anyway, hope this lends some perspective, because I'd really love to see `margin-trim` implemented.

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

Received on Friday, 1 March 2019 07:21:57 UTC