- From: Morten Stenshorne via GitHub <noreply@w3.org>
- Date: Fri, 13 Mar 2026 16:10:24 +0000
- To: public-css-archive@w3.org
It makes sense that margins are trimmed after line breaking and before flexing. However, I think margin trim should play a role *during* line breaking as well? ```html <div style="display:flex; flex-flow:wrap; margin-trim:inline; width:400px; background:cyan;"> <div style="flex:none; width:150px; height:10px; background:yellow;"></div> <div style="flex:none; width:150px; margin-right:150px; height:10px; background:gray;"></div> <div style="flex:none; width:150px; height:10px; background:blue;"></div> </div> ``` Should the gray item go on the first line here? It fits as the last item on the first line if its right margin is trimmed, and its right margin is trimmed if it's the last item on the line. WebKit already seems to do this. For negative margins, though... ```html <div style="display:flex; flex-flow:wrap; margin-trim:inline; width:400px; background:cyan;"> <div style="flex:none; width:150px; height:10px; background:yellow;"></div> <div style="flex:none; width:300px; margin-right:-150px; height:10px; background:gray;"></div> <div style="flex:none; width:150px; height:10px; background:blue;"></div> </div> ``` The gray item doesn't fit on the first line if its right margin is trimmed. It does fit if the (negative) margin is applied though, but in that case it would be the last item on the line, so its right margin should be trimmed, end then it won't fit... WebKit places it on the first line, which kind of contradicts the behavior in the first example. -- GitHub Notification of comment by mstensho Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/11398#issuecomment-4056262150 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Friday, 13 March 2026 16:10:25 UTC