position-sticky-flex-item-001.html (1154B)
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 #flex-scroller { 12 overflow: hidden; 13 inline-size: 100px; 14 block-size: 100px; 15 display: flex; 16 flex-direction: column; 17 background-color: green; 18 } 19 20 #non-sticky { 21 flex: 0 0 80px; 22 background-color: red; 23 } 24 25 #sticky { 26 position: sticky; 27 flex: 0 0 100px; 28 bottom: 0; 29 } 30 </style> 31 32 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 33 <div id="flex-scroller"> 34 <div id="non-sticky"></div> 35 <div id="sticky"></div> 36 </div> 37 38 <script> 39 // Scroll the scroll container down to the bottom. 40 document.getElementById("flex-scroller").scrollTop="1000"; 41 </script>