[csswg-drafts] [css-sizing] New value like `fit-content` that properly accounts for `text-wrap`? (#12505)

LeaVerou has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-sizing] New value like `fit-content` that properly accounts for `text-wrap`? ==
Currently, `text-wrap: balance` is unusable with any container that has a visible box (e.g. backgrounds, borders, etc.) as the box does not and cannot account for the text wrapping:

<img width="1027" height="157" alt="Image" src="https://github.com/user-attachments/assets/a695b409-6fc5-4cd1-8677-b4e5ddd221bd" />

[View in CodePen](https://codepen.io/leaverou/pen/QwjyJYV)

Since changing how `fit-content` works would not be web-compatible, perhaps we could introduce a new value (name TBB) that does it properly:

<img width="621" height="153" alt="Image" src="https://github.com/user-attachments/assets/fb6f1e53-7604-4470-b6e8-2262ba3d0067" />

Alternatively, we could introduce an inheritable "flag" that changes how `fit-content` behaves, e.g. `fit-content-sizing: text-wrap` (again, names TBB).

Or, who knows, maybe simply changing how `fit-content` behaves _is_ actually web-compatible. Unfortunately, webstatus [doesn't have any usage data](https://webstatus.dev/features/fit-content?q=fit-content) for it currently.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12505 using your GitHub account


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

Received on Sunday, 20 July 2025 23:08:02 UTC