Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
andreubotella opened this issue Apr 2, 2025 · 0 comments

Comments

@andreubotella
Copy link
Member

The line-clamp property is defined as a shorthand for three longhands, one of which is max-lines, which says that the clamp point should be after a particular line. You can also remove the max-lines property (or set the shorthand to line-clamp: auto) and set max-height to clamp by a height.

With the continue: discard approach that is currently in the spec, the clamping is based on fragmentation, and max-lines adds a region break. So if you have both max-lines and max-height and the content overflows before the specified line, it will clamp based on the height.

However, as we just resolved, line-clamp will instead default to the continue: collapse approach (see #7708) which isn't based on fragmentation. So should that have the same behavior when clamping by both a number of lines and a height?

In our implementation in Chromium, when we started working on it we decided to not support clamping by both, to focus the implementation effort to the simple cases. But maybe at this point it makes sense to reconsider this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant