position-sticky-flex-item-004.html (1343B)
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: row; 21 22 /* Use a small inline-size so that the flex items overflow the flex container. 23 It's necessary to trigger the bug. */ 24 inline-size: 10px; 25 block-size: 100px; 26 } 27 28 #non-sticky { 29 flex: 0 0 80px; 30 background-color: red; 31 } 32 33 #sticky { 34 position: sticky; 35 flex: 0 0 100px; 36 right: 0; 37 } 38 </style> 39 40 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 41 <div id="scroller"> 42 <div id="flex"> 43 <div id="non-sticky"></div> 44 <div id="sticky"></div> 45 </div> 46 </div> 47 48 <script> 49 // Scroll the scroll container to the far right. 50 document.getElementById("scroller").scrollLeft="1000"; 51 </script>