<div id="a" style="width: 0; max-lines: 2">
<div id="b" style="max-lines: 1">Lorem ipsum</div>
dolor
</div>
Due to #b's max-lines: 1, only Lorem is displayed and ipsum is discarded.
But #a has max-lines: 2. Does ipsum still count as one line, and thus dolor is discarded?
Excellent question. I think we should only count the lines that are actually there, and therefore not count ipsum and not discard dolor. Otherwise:
I think that is actually what the spec says already, since we're only counting line boxes, and ipsum isn't in a line box, but a clarifying note would certainly not hurt.
@fantasai, do you agree?
We would get the wrong number of lines from the users's point of view.
Yes, but this objective is hard to generalize. What if I use max-height: 1lh; overflow: clip instead of max-lines: 1? Visually it would be the same, but now both lines would be counted...
The "what about lines in overflow:clip` part question solves itself if:
overflow:clip creates a BFC, andI am not expressing either being for or against either of these, but they're dependencies, so we should look into this issue after we look into these.
Given that we've resolved #2429 to make max-lines skip counting lines in descedant BGCs, but #1971 to say that overflow:clip does not create a BFC, the question remains open for overflow:clip.
I don't think there's any technical reason to make max-lines skip the descendants of overflow:clip, so we could close this as no change. On the other hand, maybe it is counter intuitive that we'd be counting invisible lines.
I agree that overflow: clip shouldn't affect whether a line is counted for max-lines. overflow: clip to me is mostly a visual effect (and I think the name "clip" suggests that too). You can also have lines partially visible when using overflow: clip, another indication that it is working visually rather than fragmenting away content that is overflowing.
Right. We should close this as no change.
So max-lines: 1 moves the second line to another region and it's not counted, and max-height: 1lh; overflow: clip counts it?
Some clarification would be useful, maybe a note or example.
Yeah, I agree there is no change.
max-lines:1 makes ipsum discarded, because max-lines does the layout.
max-height: 1lh; overflow: clip makes ipsum counted, because max-height does the layout and overflow just does a visual effect.
The Working Group just discussed How does max-lines interact with hidden content?, and agreed to the following:
RESOLVED: keep current definition such that we could all lines in overflow:clip descendantThe full IRC log of that discussion
<dael> Topic: How does max-lines interact with hidden content?
<dael> github: https://github.com/w3c/csswg-drafts/issues/2421
<dael> florian: This started much broader and we're almost done. Just a corner case we haven't decided explicitly.
<dael> florian: The broad topic is which lines tdo we count when w have max-lines and a decendent or BFCs or a child also with max-lines. We resolved we skip when you nest max-lines. Resolved for most of overflow. Remaining bit is overflow:clip
<dael> florian: overflow:clip is not a BFC so it implies you could the lines inline overflow:clip. I think close this with no more changes needed.
<dael> Rossen_: Is the issue different if overflow:clip is applied to max-lines container?
<dael> florian: This is on decendant
<dael> Rossen_: How different then when on max-line container?
<dael> florian: On container it doesn't do anything special and overflow not terribly relevent.
<dael> Rossen_: But then you can extract same thing happens with child.
<dael> florian: So you're okay no change?
<dael> Rossen_: Yes
<dael> astearns: WE could lines in decendant with overflow:clip, but only not overflowing?
<dael> florian: Count all the lines
<dael> Rossen_: Overflow:clip doesn't effect count of lines
<dael> florian: Right
<dael> astearns: Gotcha
<dael> astearns: Objections to keep current definition such that we could all lines in overflow:clip decendant?
<dael> fantasai: I think this is correct. Might be initially confusing but it's the right model
<dael> RESOLVED: keep current definition such that we could all lines in overflow:clip descendant
Most helpful comment
I agree that
overflow: clipshouldn't affect whether a line is counted formax-lines.overflow: clipto me is mostly a visual effect (and I think the name "clip" suggests that too). You can also have lines partially visible when usingoverflow: clip, another indication that it is working visually rather than fragmenting away content that is overflowing.