position-sticky-left-004.html (1218B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Position Test: Test position:sticky element with 100% left in a block container</title> 4 <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> 5 <link rel="author" title="Mozilla" href="https://www.mozilla.org/"> 6 <link rel="help" href="https://drafts.csswg.org/css-position/#sticky-pos"> 7 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1748891"> 8 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1835705"> 9 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> 10 <meta name="assert" content="This test verifies that a position:sticky element with 100% left value does not cause the scrollbar to show when shrinking the width of its overflow container."> 11 12 <style> 13 #scroll { 14 width: 200px; 15 height: 100px; 16 overflow: auto; 17 background: red; 18 } 19 .sticky { 20 position: sticky; 21 width: 100px; 22 height: 100px; 23 left: 100%; 24 background: green; 25 } 26 </style> 27 28 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 29 <div id="scroll"> 30 <div class="sticky"></div> 31 </div> 32 33 <script> 34 window.onload = () => { 35 document.getElementById("scroll").style.width = "100px"; 36 }; 37 </script>