webkit-line-clamp-017.html (1058B)
1 <!DOCTYPE html> 2 <html class="reftest-wait"> 3 <meta charset="utf-8"> 4 <title>CSS Overflow: Dynamically changing -webkit-line-clamp</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-017-ref.html"> 8 <meta name="assert" content="Dynamically changing -webkit-line-clamp on an element from none to a number less than the number of lines should apply the clamping."> 9 <style> 10 .clamp { 11 display: -webkit-box; 12 -webkit-box-orient: vertical; 13 font: 16px / 32px serif; 14 white-space: pre; 15 padding: 0 4px; 16 background-color: yellow; 17 overflow: hidden; /* can be removed once implementations update their old -webkit-line-clamp implementations */ 18 } 19 </style> 20 <div class="clamp">Line 1 21 Line 2 22 Line 3 23 Line 4 24 Line 5</div> 25 <p>Following content.</p> 26 <script> 27 window.onload = function() { 28 document.querySelector(".clamp").style.webkitLineClamp = 3; 29 document.documentElement.className = ""; 30 }; 31 </script>