Re: [csswg-drafts] [css-box-4] Should margin-trim have a 'floats' value? (#3256)

There are a few more complexities here for this feature:

Determining the "end" of content is complicated for floats, and atomic-inlines (anything on a line) and makes this difficult to implement. E.g. consider: https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=9695

Floats can end up in quasi states where their margin might be trimmed, however they aren't at the "end" of the content. E.g.
 https://www.software.hixie.ch/utilities/js/live-dom-viewer/?saved=9693 getting this case correct for block layout falls into the "very difficult" category, as you may have to walk arbitrarily back in the content.

Its also quite common for atomic-inlines to have margin to adjust their position on a line, e.g. `<img style="margin-bottom: 1em";>` to position something as a sup of similar (this is also super common on first-letter pseudo).

This feature works well for inflow-content. Grid/flex have very simple models here and is relatively straight forward. Block-flow is a very complicated model due to how margin-collapsing, floats all interact. Block-flow layout is really 3 different layout modes combined into one.

Block-flow layout is the only thing here where we are going more than one level deep. The way that margins work for inflow-block-level content would make it very straight forward to implement for inflow block-level content. This is similar to how the prefixed `-webkit-margin-collapse` class of properties worked. Atomic-inlines and in particular floats make this very difficult to reason about and implement.

> But attempting to auto-opt-out an entire category of elements (based on their relationship to flow) feels like an unreliable heuristic, and doesn't match any consistent author patterns that I've seen.

We've already done this for the other category of out-of-flow elements?


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


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 7 October 2021 16:58:30 UTC