position-sticky-left-005.html (1234B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Position Test: Test position:sticky element with 100% left in a grid 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 display: grid; 15 width: 200px; 16 height: 100px; 17 overflow: auto; 18 background: red; 19 } 20 .sticky { 21 position: sticky; 22 width: 100px; 23 height: 100px; 24 left: 100%; 25 background: green; 26 } 27 </style> 28 29 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 30 <div id="scroll"> 31 <div class="sticky"></div> 32 </div> 33 34 <script> 35 window.onload = () => { 36 document.getElementById("scroll").style.width = "100px"; 37 }; 38 </script>