Re: [csswg-drafts] [css-flexbox-1] Clamp "hypothetical main size" to be non-negative? (#12222)

After thinking a bit, I don't like the 2nd resolution from https://github.com/w3c/csswg-drafts/issues/3070#issuecomment-3820856620

I think it makes no sense for line breaking to differ from layout , and this will just cause confusion among authors.

Consider for example

```html
<!DOCTYPE html>
<style> div > div { width: 100px; height: 100px; box-sizing: border-box; } </style>
<div style="display: flex; flex-wrap: wrap; width: 300px; border: solid">
  <div style="background: cyan"></div>
  <div style="background: yellow"></div>
  <div style="height: 50px; margin-left: -200px; background: orange"></div>
  <div style="height: 50px; background: lime"></div>
  <div style="height: 50px; background: blue"></div>
</div>
```

Currently, all items fit in a single line, because 100+100-100+100+100 = 300

<img width="316" height="117" alt="Image" src="https://github.com/user-attachments/assets/85e28d85-5504-4629-a70f-252f6efaae0e" />

The resolution changes the behavior to

<img width="316" height="166" alt="Image" src="https://github.com/user-attachments/assets/6e33a902-6a0e-431e-85aa-32ee9a329388" />

Now the blue item is moved into the 2nd line, because the 1st line is considered to be filled by the previous items (100+100+0+100 = 300)

But if you look at the result, there is clearly space at the right of the lime item. So why doesn't the blue item go there? makes no sense.

Instead, I think the right way to address this would be adjusting the end margin to make the outer size be non-negative. Then it makes sense:

<img width="316" height="166" alt="Image" src="https://github.com/user-attachments/assets/962fcccf-3e59-4228-9691-e1fd206036b4" />



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


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

Received on Friday, 30 January 2026 02:03:53 UTC