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 was currently in the spec at the time of writing, 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.
The
line-clampproperty is defined as a shorthand for three longhands, one of which ismax-lines, which says that the clamp point should be after a particular line. You can also remove themax-linesproperty (or set the shorthand toline-clamp: auto) and setmax-heightto clamp by a height.With the
continue: discardapproach that was currently in the spec at the time of writing, the clamping is based on fragmentation, andmax-linesadds a region break. So if you have bothmax-linesandmax-heightand the content overflows before the specified line, it will clamp based on the height.However, as we just resolved,
line-clampwill instead default to thecontinue: collapseapproach (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.