- From: Florian Rivoal via GitHub <noreply@w3.org>
- Date: Wed, 17 Sep 2025 09:27:26 +0000
- To: public-css-archive@w3.org
frivoal has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-overflow-4] where to clamp when a float pushes a whole line down == Given the following, what should happen? ```html <style> .clamp { line-clamp: auto; max-height: 5lh; white-space: pre-wrap; width: 200px; } .float { float: left; width: 300px; } </style> <div class="clamp">Line 1 Line 2 Line 3 Line 4 <div class="float">Float</div>Line 5 Line 6</div> ``` Currently, the spec allows clamp points in the following locations: > Line-clamp containers can have a clamp point, which is one of the following block-axis positions inside it: > * The start of the [line-clamp container](https://drafts.csswg.org/css-overflow-4/#line-clamp-container). > * A point between two consecutive [line boxes](https://drafts.csswg.org/css-inline-3/#line-box) in an [inline formatting context](https://drafts.csswg.org/css-display-4/#inline-formatting-context) contained by the line-clamp container’s [block formatting context](https://drafts.csswg.org/css-display-4/#block-formatting-context). > * A point between two [in-flow](https://drafts.csswg.org/css-display-4/#in-flow) [block-level](https://drafts.csswg.org/css-display-4/#block-level) sibling boxes in the line-clamp container’s [block formatting context](https://drafts.csswg.org/css-display-4/#block-formatting-context). Clearly, line 5 and 6 don't fit within the allocated height, and the float does, but is there a valid clamp point between "Line 4" and the float, or between the float and "line 5"? If there isn't, the latest clamp point that works would be between "line 3" and "line 4". That seems undesirable. Is there something that falls out of the definition of floats (like this float being inside a line somehow, or there being a zero-width line next to it)? I'm not an expert, but I suspect not. If not, to avoid the clamp point being between line 3 and 4, we probably want to add or tweak something to the list of possible clamp points above. But in that case, should we want clamp points to be allowed before or after the float (or both)? In a simple example like this one, it might seem that both/after the float would be preferable, but if the width of the element is filled not by one, but several floats of different heights (some going beyond the limit and some not), that seem a lot harder to handle, so maybe allowing the clamp point only before the float is preferable? (this is based on [line-clamp-auto-015.tentative.html](https://github.com/web-platform-tests/wpt/blob/master/css/css-overflow/line-clamp/line-clamp-auto-015.tentative.html), which should be updated depending on the conclusion here) Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12817 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 17 September 2025 09:27:26 UTC