Open Bug 1232992 Opened 9 years ago Updated 9 months ago

Implement max-lines property

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

UNCONFIRMED
Tracking Status
platform-rel --- -

People

(Reporter: percyley, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug, )

Details

(Keywords: dev-doc-needed, Whiteboard: [platform-rel-Pinterest])

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.80 Safari/537.36

Steps to reproduce:

The max-lines property allows authors to use a larger font for the first few lines of an article. Without the max-lines property, authors might have to use the height property instead, but that would leave a slight gap if the author miscalculated how much height a given number of lines would occupy (which might beparticularly hard if the author didn’t know what text would be filling the space, exactly what font would be used, or exactly which platform’s font rendering would be used to display the font).
This doesn't make sense without the rest of the spec, which we don't implement.
What do we need?I see the spec editor is you.
We'd need bug 874238 (implementing the main part of the spec).
Depends on: 874238
Summary: [css-overflow-3]Implement the max-lines property → [css-overflow-3] Implement the max-lines property
@Daniel Holbert Thanks!
And before implementing bug 874238, the spec itself needs more work. Well, implementation experience could help finishing the spec, but the point is, the spec isn't done.

(co-editor speaking)
platform-rel: --- → ?
Whiteboard: [platform-rel-Pinterest]
platform-rel: ? → +
Rank: 10
I see the `lh` unit from https://developer.mozilla.org/en-US/docs/Web/CSS/length;
May be able to achieve the desired results
Not really, since the 'line-height' isn't actually the height of the lines; it's a contribution that each non-replaced inline makes to the height of the line.
Indeed, it does not. See this note, from the lh spec:

Note: setting the height of an element using either the lh or the rlh units does not enable authors to control the actual number of lines in that element. These units only enable length calculations based on the theoretical size of an ideal empty line; the size of actual lines boxes may differ based on their content. In cases where an author wants to limit the number of actual lines in an element, the max-lines property shall be used instead.
There's an new tentative spec for max-lines: https://drafts.csswg.org/css-overflow-3/#max-lines

This is designed to solve the -webkit-line-clamp problem (https://bugzilla.mozilla.org/show_bug.cgi?id=866102) as well as being usable standalone.

This introductory comment is probably a good place to start reading about it:
https://github.com/w3c/csswg-drafts/issues/390#issuecomment-371076389
This was designed to be forward compatible with the fragment overflow feature of css-overflow level 4, but to not technically depend on it, so I'm removing the "blocked by https://bugzilla.mozilla.org/show_bug.cgi?id=874238" dependency.

It does depend on parts of css-break-3, but since this is just "parts of", and not the whole thing, I am unsure as whether to mark this as blocked by https://bugzilla.mozilla.org/show_bug.cgi?id=775628 or not.
No longer depends on: 874238
Depends on: 1540681
Type: defect → enhancement
Severity: normal → S3
Summary: [css-overflow-3] Implement the max-lines property → Implement max-lines property
You need to log in before you can comment on or make changes to this bug.