webkit-line-clamp-021.html (1119B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <meta charset="utf-8"> 4 <title>CSS Overflow: Dynamically changing contents of a -webkit-line-clamp affected element</title> 5 <link rel="author" title="Cameron McCormack" href="mailto:cam@mcc.id.au"> 6 <link rel="help" href="https://drafts.csswg.org/css-overflow-3/#webkit-line-clamp"> 7 <link rel="match" href="reference/webkit-line-clamp-021-ref.html"> 8 <meta name="assert" content="Dynamically changing contents of a -webkit-line-clamp element so that it exceeds the specified number of lines should start clamping."> 9 <style> 10 .clamp { 11 display: -webkit-box; 12 -webkit-box-orient: vertical; 13 -webkit-line-clamp: 3; 14 font: 16px / 32px serif; 15 white-space: pre; 16 padding: 0 4px; 17 background-color: yellow; 18 overflow: hidden; /* can be removed once implementations update their old -webkit-line-clamp implementations */ 19 } 20 </style> 21 <div class="clamp">Line 1 22 Line 2</div> 23 <p>Following content.</p> 24 <script> 25 window.onload = function() { 26 document.querySelector(".clamp").textContent = `Line 1 27 Line 2 28 Line 3 29 Line 4 30 Line 5`; 31 document.documentElement.className = ""; 32 }; 33 </script>