Re: [csswg-drafts] [css-overflow] Can you line-clamp by both a number of lines and a height at the same time? (#12041)

The CSS Working Group just discussed `[css-overflow] Can you line-clamp by both a number of lines and a height at the same time?`, and agreed to the following:

* `RESOLVED: line-clamp: <integer> with a height constraint clamps by height or by lines, depending on what comes earlier, pending compat issues`

<details><summary>The full IRC log of that discussion</summary>
&lt;JoshT> andreubotella: [shares slides]<br>
&lt;JoshT> ... when we looked at line-clamp, this was not the approach we would take in other browsers<br>
&lt;JoshT> ... you can have a fragment. the first fragment has a forced breakup. if you move the height so it breaks before the line where it breaks, the content moves into the second fragment<br>
&lt;JoshT> ... but does the line clamp still apply?<br>
&lt;JoshT> ... when I was prototyping this, we understood it to be clamping by lines or height but not both at the same time<br>
&lt;JoshT> ... I didn't realise that this was not the agreed approach until in april F2F<br>
&lt;JoshT> ... I implemented this recently and have no problem with it being in the spec<br>
&lt;JoshT> PROPOSED: line-clamp: &lt;integer> with a height constraint clamps by height or by lines, depending on what comes earlier<br>
&lt;JoshT> ... height constraint means height, max-height, etc.<br>
&lt;JoshT> ... could be a constraint through the intrinsic layout<br>
&lt;JoshT> ... we accidentally shipped this behaviour in Chrome 140 and it was reported as a regression by two devs<br>
&lt;JoshT> ... we reverted the change and have added use counters for line-clamp with height constraints<br>
&lt;JoshT> ... we hope to have useful data in December<br>
&lt;JoshT> ... I asked those devs what their use cases were<br>
&lt;JoshT> ... for one, their use case would not be affected by this change<br>
&lt;florian> q+<br>
&lt;JoshT> ... it is possible we might need to not do this for the -webkit-line-clamp. we will know in December<br>
&lt;JoshT> florian: In general, I support proposal<br>
&lt;JoshT> ... if you have ten lines, you ask for four, you cut off at three, I think this is better<br>
&lt;JoshT> ... if we are constrained by compat, I would be sad but OK having a difference between -webkit- and non-prefixed<br>
&lt;JoshT> ... if the breakage is bad, we can do a difference in behaviour<br>
&lt;JoshT> fantasai: I agree with florian. I had some questions<br>
&lt;Kurt> https://issues.chromium.org/issues/436345865#comment23<br>
&lt;JoshT> ... if only one line fits, we should make that line doesn't get clamped<br>
&lt;JoshT> ... it seemed like in one case, they had a line height of 1em and a line clamp of 3 lines and a max-height of 3<br>
&lt;JoshT> ... in theory, there should be no conflucts between these two unless you have substancial content<br>
&lt;JoshT> ... there are often small difference in line hieght which can create a small amount of overflow not visible to the author<br>
&lt;florian> q+<br>
&lt;JoshT> ... so we might need some slack when working out whether to push over a line to the next fragment<br>
&lt;JoshT> andreubotella: do you expect a difference between just line-clamp or with height as well when calculating slack<br>
&lt;JoshT> fantasai: not sure. maybe we do that. if it's something that's weird that we have to do for web compat, maybe we do have the difference for the -webkit- prefixed version<br>
&lt;JoshT> ... it might end up being something reasonable<br>
&lt;JoshT> florian: I can't see how we make it work. there is not clamp by height.<br>
&lt;JoshT> ... the height you set is with regular height properties or the layout system<br>
&lt;JoshT> ... so I don't think we can give slack to the actual height<br>
&lt;JoshT> ... you could let content overflow just a little bit<br>
&lt;JoshT> ... I was wondering if instead of clamping or sizing, could this be about what we have in the css inline layout spec<br>
&lt;JoshT> fantasai: yes could be related. we will have to see<br>
&lt;JoshT> ... if we get a lot of cases where this is an actual problem and the maths doesn't work out<br>
&lt;JoshT> PROPOSED: line-clamp: &lt;integer> with a height constraint clamps by height or by lines, depending on what comes earlier<br>
&lt;JoshT> RESOLVED: line-clamp: &lt;integer> with a height constraint clamps by height or by lines, depending on what comes earlier, pending compat issues<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12041#issuecomment-3250054852 using your GitHub account


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

Received on Wednesday, 3 September 2025 17:02:24 UTC