position-sticky-bottom-007.html (936B)
1 <!DOCTYPE html> 2 <title>CSS Position Test: sticky element with bottom offset</title> 3 <link rel="author" title="Oriol Brufau" href="obrufau@igalia.com"> 4 <link rel="help" href="https://drafts.csswg.org/css-position/#stickypos-insets"> 5 <link rel="match" href="../../reference/ref-filled-green-100px-square.xht"> 6 <meta name="assert" content=" 7 When the scroll container is scrolled to the top, then #sticky is visible. 8 If we scroll 100px down, then #sticky should update its sticky offsets 9 to still be visible. 10 "> 11 12 <style> 13 #scroll-container { 14 overflow: hidden; 15 width: 100px; 16 height: 100px; 17 background: red; 18 } 19 #sticky { 20 position: sticky; 21 bottom: 0; 22 height: 100px; 23 background: green; 24 } 25 </style> 26 27 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 28 29 <div id="scroll-container"> 30 <div style="height: 500px"></div> 31 <div id="sticky"></div> 32 </div> 33 34 <script> 35 scroller.scrollTop = 100; 36 </script>