webkit-line-clamp-044.html (1175B)
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="help" href="https://drafts.csswg.org/css-overflow-4/#line-clamp"> 6 <link rel="match" href="reference/webkit-line-clamp-044-ref.html"> 7 <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."> 8 <style> 9 .clamp { 10 display: -webkit-box; 11 -webkit-box-orient: vertical; 12 -webkit-line-clamp: 5; 13 /* no overflow: hidden */ 14 background-color: yellow; 15 padding: 0.5em; 16 font-size: 16px / 32px serif; 17 white-space: pre; 18 } 19 .float { 20 /* Floats create a parallel fragmentation context, and even if 21 * -webkit-line-clamp caused a forced break in the main context, that should 22 * not cause the float to fragment. */ 23 float: left; 24 background-color: orange; 25 padding: 0.5em; 26 height: 100px; 27 width: 100px; 28 } 29 </style> 30 31 <div class="clamp"><div>Line 1 32 Line 2 33 Line 3 34 Line 4 35 <div class="float"></div>Line 5</div></div>