line-clamp-018.html (1087B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: line-clamp with -webkit-box and -webkit-box-orient</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-001-ref.html"> 7 <meta name="assert" content="If display: -webkit-box and -webkit-box-orient: vertical are present on the same box as line-clamp, it becomes a block container, and other flexbox properties don't apply. This happens even if there is no clamping."> 8 <style> 9 .clamp { 10 display: -webkit-box; 11 -webkit-box-orient: vertical; 12 line-clamp: 6; 13 font: 16px / 32px serif; 14 white-space: pre; 15 background-color: yellow; 16 17 /* If display: -webkit-box behaves the same as without line-clamp, 18 * these properties would cause the anonymous inline box to be centered. */ 19 -webkit-box-align: center; 20 -webkit-box-pack: center; 21 align-items: center; 22 justify-content: center; 23 } 24 </style> 25 <div class="clamp"><div>Line 1 26 Line 2 27 Line 3 28 Line 4 29 Line 5</div></div>