line-clamp-auto-004.html (771B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: `line-clamp: auto` when the max-height isn't an exact number of lines</title> 4 <link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com"> 5 <link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp"> 6 <link rel="match" href="reference/webkit-line-clamp-005-ref.html"> 7 <meta name="assert" content="line-clamp: auto will clamp lines that start before the maximum block size but overflow, and set the intrinsic block size to the last line before clamp"> 8 <style> 9 .clamp { 10 line-clamp: auto; 11 max-height: 4.5lh; 12 font: 16px / 32px serif; 13 white-space: pre; 14 background-color: yellow; 15 padding: 0 4px; 16 } 17 </style> 18 <div class="clamp">Line 1 19 Line 2 20 Line 3 21 Line 4 22 Line 5 23 Line 6</div>