line-clamp-with-floats-010.tentative.html (1287B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Overflow: line-clamp hidden floats should count as ink overflow</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/line-clamp-with-floats-010-ref.html"> 7 <meta name="assert" content="Any overflowing content hidden from paint by line-clamp is treated as ink overflow, including floats, and therefore doesn't cause the scrollable overflow rectangle to grow. Meanwhile, non-hidden floats count as scrollable overflow."> 8 <style> 9 #scrollContainer { 10 overflow: scroll; 11 font: 16px / 32px serif; 12 height: 4lh; 13 border: 1px solid black; 14 } 15 .clamp { 16 line-clamp: 4; 17 padding: 0 4px; 18 white-space: pre; 19 background-color: yellow; 20 } 21 .float { 22 float: left; 23 width: 50px; 24 height: 50px; 25 margin: 4px; 26 background-color: skyblue; 27 } 28 </style> 29 30 <div id="scrollContainer"> 31 <div class="clamp">Line 1 32 Line 2 33 Line 3 34 Line 4<div class="float"></div> 35 Line 5 36 Line 6<div class="float"></div></div> 37 </div> 38 39 <script> 40 window.addEventListener("load", () => { 41 const scrollContainer = document.getElementById("scrollContainer"); 42 scrollContainer.scrollTop = scrollContainer.scrollHeight; 43 }); 44 </script>