Re: [csswg-drafts] [css-sizing-4] How does height: stretch interact with margin collapsing with parent (#11044)

> Sure, but what size?

@tabatkins, with this particular question, which are you inquiring about?

1. Specific pixel heights: The exact height of each child element in the 3-child example? OR
2. The general sizing approach: Whether the goal is to match the margin box sizes or content box sizes?
--------
I think another similar realistic 3-child example would be
```html
<style>
span {
  display: block;
  height: -webkit-fill-available;
  border: 4px dashed red;
  margin-bottom: 100px;
}
</style>
<div style="height: 200px; overflow-y: scroll; outline: solid">
  <div style="height: 300px;">
    <span></span>
    <span></span>
    <span></span>
  </div>
</div>
```
https://jsfiddle.net/dgrogan/7qxkasLn/3/

With Blink's existing behavior, these children have the same border-box size. With the margin-collapsing-anticipating behavior, the bottom child is 100px taller.

(I know the original intention of `stretch` was not to satisfy this example. It merely demonstrates the _existence_ of reasonable cases where Blink's existing simple behavior works better than the margin-collapsing-anticipating behavior.)

-------
Back to the broader issue, we have a 4th bad scenario Ian brought up last week in https://github.com/w3c/csswg-drafts/issues/11044#issuecomment-2521425687.

4. adding/removing a child shouldn't cause an existing `height: stretch` child to suddenly change size.

Maybe violating this rule is least bad, compared to the other 3 rules? Meaning we'd do margin-collapsing-anticipation in the single-child case and Blink's existing behavior in the multiple-child case. We'd follow the 3 other rules from https://github.com/w3c/csswg-drafts/issues/11044#issuecomment-2532837465.

If we do this dynamic rule, the original single-child case works as originally intended. And the multiple-child case is well-defined (and _easily_-defined), which satisfies the other original requirement of `stretch`.

Thoughts?

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


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

Received on Wednesday, 11 December 2024 21:36:51 UTC