webkit-line-clamp-020.html (1074B)
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-020-ref.html"> 8 <meta name="assert" content="Dynamically changing -webkit-line-clamp on an element from a number greater than to a number less than the number of lines."> 9 <style> 10 .clamp { 11 display: -webkit-box; 12 -webkit-box-orient: vertical; 13 -webkit-line-clamp: 6; 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").style.webkitLineClamp = 3; 30 document.documentElement.className = ""; 31 }; 32 </script>