top-bottom-2.html (1032B)
1 <!DOCTYPE html> 2 <!-- Any copyright is dedicated to the Public Domain. 3 - http://creativecommons.org/publicdomain/zero/1.0/ --> 4 <html> 5 <head> 6 <title>CSS Test: Sticky Positioning - top+bottom, at middle</title> 7 <link rel="author" title="Corey Ford" href="mailto:cford@mozilla.com"> 8 <link rel="match" href="top-bottom-2-ref.html"> 9 <meta name="flags" content="dom"> 10 <meta name="assert" content="Top+bottom sticky, scrolled to the middle: should stay in its normal position"> 11 <style> 12 #scroll { 13 height: 100px; 14 overflow: hidden; 15 } 16 #sticky { 17 position: sticky; 18 top: 10px; 19 bottom: 10px; 20 height: 10px; 21 background-color: black; 22 } 23 </style> 24 </head> 25 <body> 26 <div id="scroll"> 27 <div style="height: 100px"></div> 28 <div id="sticky"></div> 29 <div style="height: 100px"></div> 30 </div> 31 <script type="application/javascript"> 32 document.getElementById("scroll").scrollTop = 50; 33 </script> 34 </body> 35 </html>