-
Notifications
You must be signed in to change notification settings - Fork 661
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
[css-overflow-4] line-clamp max-lines
- support auto
value to fit container
#9368
Comments
If I am not mistaken, this use case is already covered by Though it looks like this can't be set via the shorthand So I suggest to change the syntax to none | [ <integer [1,∞]>? <'block-ellipsis'>? ]! With that change, one could write Sebastian |
Correct.
Seems reasonable to me. |
|
FYI @yairEO you can sort of do this in pure CSS now, but you need to provide container queries for a fixed number of lines. Here's an example: |
Right, but for that case authors can still use the longhands. Alternatively, they could provide an empty string for the Sebastian |
max-lines
- support auto
value to fit container
The syntax proposal for Sebastian |
I really hope this tiny easy change, with a lot of potential for the web, will be implemented ASAP |
The syntax change to Sebastian |
Given that this is just allowing in the shorthand something useful that’s already possible with the longhands, and the consensus in the discussion so far, I think this is reasonable to resolve asynchronously. The CSSWG will automatically accept this resolution one week from now if no objections are raised here. Anyone can add an emoji to this comment to express support. If you do not support this resolution, please add a new comment. Proposed Resolution: Change the |
RESOLVED: Change the line-clamp shorthand syntax to allow omitting the max-lines value |
@frivoal, I think the second alternative should be wrapped in - Value: none | <<integer [1,∞]>>? <<'block-ellipsis'>>?
+ Value: none | [ <<integer [1,∞]>>? <<'block-ellipsis'>>? ]! |
This comment was marked as outdated.
This comment was marked as outdated.
Yes the grammar should use |
I've always thought that there was an implicit So, should I add a cc: @fantasai @tabatkins |
I think the correct answer here is to use (This side-steps your question about !... frankly it's never come up before.) |
The meaning of It seems awkward to accept an empty value in a property value definition but reject it implicitly as a convention. And from an implementation perspective, things like |
@frivoal Empty values are valid on custom properties, since they have grammar CSS.supports("--a", ""); // true |
This is kind of like the Just now it occurred to me. interesting similarities with completely different naming. |
Reopening so that I don't loose track of the fact I've got follow up edits to make |
Feature request
Spec links
Currently
-webkit-line-clamp
property only supports an integer number which represents the maximumnumber of lines to possibly render before truncating the text with an ellipsis.
I have a use-case where I need an dynamic value for the
-webkit-line-clamp
so it matches thenumber of lines which can fit in the container (which is being truncated), assuming the container
has a dynamic height.
Also important - nothing should be painted past the ellipsis point (unlike today when the container's height is set to a value greater than the height of the truncated lines)
Example:
https://jsbin.com/kovuwow/edit?html,css,output
If you want
line-clamp
to (show N lines that can) fit the container element, it is currently impossible:line-clamp--auto-value.mp4
Javascript-based solution
I've hacked this using (a lot of) javascript: https://codepen.io/vsync/pen/eYbGgGL
line-clamp--auto-value.mp4
Related StackOverflow questions:
The text was updated successfully, but these errors were encountered: