Re: [csswg-drafts] [css-values-5] [css-overflow-4]How does `line-clamp` transition from `<integer>` to `auto` or `none`? (#10502)

The examples in https://github.com/w3c/csswg-drafts/issues/10502#issuecomment-2428826011 rely on the fact that the text is plain and unstyled, and that there's not margin/padding/border disrupting things. If they were, we couldn't use a `lh` value to achieve that effect. A reasonably obvious use case is the exact same as these two examples, but with enough styling and odd content that `lh` is not a good fit.

However, solving that seems hard. In a way, we'd need a value (`line-clamp: end` ?) which *computes* to the number of line in the element, so as to have no effect, but to provide a point from which animations / transitions could run. However, that doesn't actually make sense, because computed values are determined before layout, and at that stage, you don't know how many lines there will be. A JS-based workaround which waits for layout to be complete, counts lines, and then sets the value to that, is quite achievable, but as a pure CSS solution, it doesn't seem particularly easy to solve.

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


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

Received on Friday, 6 June 2025 10:42:36 UTC