webkit-line-clamp-047.html (1262B)
1 <!DOCTYPE html> 2 <meta charset="UTF-8"> 3 <title>CSS Overflow: -webkit-line-clamp creates an IFC</title> 4 <link rel="author" title="Andreu Botella" href="mailto:abotella@igalia.com"> 5 <link rel="author" title="Florian Rivoal" href="https://florian.rivoal.net"> 6 <link rel="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp"> 7 <link rel="match" href="reference/webkit-line-clamp-047-ref.html"> 8 <meta name="assert" content="-webkit-line-clamp always creates an independent formatting context, even without overflow: hidden, which causes the height to grow to the clearance of floats."> 9 <style> 10 .clamp { 11 display: -webkit-box; 12 -webkit-box-orient: vertical; 13 -webkit-line-clamp: 5; 14 /* no overflow: hidden */ 15 background-color: yellow; 16 padding: 0.5em; 17 font: 16px / 32px serif; 18 white-space: pre; 19 } 20 .float { 21 /* Floats create a parallel fragmentation context, and even if 22 * -webkit-line-clamp caused a forced break in the main context, that should 23 * not cause the float to fragment. */ 24 float: left; 25 background-color: orange; 26 padding: 0.5em; 27 height: 100px; 28 width: 100px; 29 } 30 </style> 31 32 <div class="clamp"><div>Line 1 33 Line 2 34 Line 3 35 Line 4 36 <div class="float"></div>Line 5</div> 37 Line 6 38 Line 7</div>