webkit-line-clamp-022.html (1128B)
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-022-ref.html"> 8 <meta name="assert" content="Dynamically changing contents of a -webkit-line-clamp element so that it no longer exceeds the specified number of lines should stop 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 23 Line 3 24 Line 4 25 Line 5</div> 26 <p>Following content.</p> 27 <script> 28 window.onload = function() { 29 document.querySelector(".clamp").textContent = `Line 1 30 Line 2`; 31 document.documentElement.className = ""; 32 }; 33 </script>