position-sticky-flex-item-003.html (1325B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <link rel="author" title="Ting-Yu Lin" href="mailto:tlin@mozilla.com"> 4 <link rel="author" title="Mozilla" href="https://www.mozilla.org"> 5 <link rel="help" href="https://drafts.csswg.org/css-position-3/#stickypos-insets"> 6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1377072"> 7 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> 8 <meta name="assert" content="This test verifies that the sticky flex item reserves its in-flow space in the scroll container's overflow area."> 9 10 <style> 11 #scroller { 12 overflow: hidden; 13 inline-size: 100px; 14 block-size: 100px; 15 background-color: green; 16 } 17 18 #flex { 19 display: flex; 20 flex-direction: column; 21 22 /* Use a small block-size so that the flex items overflow the flex container. 23 It's necessary to trigger the bug. */ 24 block-size: 10px; 25 } 26 27 #non-sticky { 28 flex: 0 0 80px; 29 background-color: red; 30 } 31 32 #sticky { 33 position: sticky; 34 flex: 0 0 100px; 35 bottom: 0; 36 } 37 </style> 38 39 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 40 <div id="scroller"> 41 <div id="flex"> 42 <div id="non-sticky"></div> 43 <div id="sticky"></div> 44 </div> 45 </div> 46 47 <script> 48 // Scroll the scroll container down to the bottom. 49 document.getElementById("scroller").scrollTop="1000"; 50 </script>