line-clamp-035.html (730B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: `line-clamp` with a number and a smaller max-height</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="If line-clamp is set to a number, and there is a (max-)height, the line-clamp container will clamp to whichever comes earlier."> 8 <style> 9 .clamp { 10 line-clamp: 6; 11 max-height: 4lh; 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 24 Line 7</div>