line-clamp-auto-035.html (1042B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: `line-clamp: auto` with non-overflowing block with set 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="With `line-clamp: auto`, the clamp point is set at the furthermost possible clamp point where the box doesn't go past the max-height. If there is an inner box with a set height, and it doesn't overflow, every clamp point inside it would increase the line-clamp container's block size by the same amount as the clamp point after the box."> 8 <style> 9 .clamp { 10 line-clamp: auto; 11 max-height: 6lh; 12 font: 16px / 32px serif; 13 white-space: pre; 14 padding: 0 4px; 15 background-color: yellow; 16 } 17 .with-height { 18 height: 3lh; 19 background-color: red; 20 } 21 </style> 22 23 <div class="clamp">Line 1 24 Line 2 25 Line 3 26 Line 4 27 <div class="with-height">Line 5 28 Line 6</div> 29 Line 7</div>