top-1.html (1065B)
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, normal position</title> 7 <link rel="author" title="Corey Ford" href="mailto:cford@mozilla.com"> 8 <link rel="match" href="top-1-ref.html"> 9 <meta name="assert" content="Sticky-top with no scrolling: should be in its normal position"> 10 <style> 11 #scroll { 12 height: 100px; 13 overflow: hidden; 14 } 15 #contain { 16 height: 300px; 17 background-color: gray; 18 } 19 #sticky { 20 position: sticky; 21 top: 10px; 22 height: 10px; 23 background-color: black; 24 } 25 #static { 26 height: 10px; 27 background-color: blue; 28 } 29 </style> 30 </head> 31 <body> 32 <div id="scroll"> 33 <div style="height: 20px"></div> 34 <div id="contain"> 35 <div id="sticky"></div> 36 <div id="static"></div> 37 </div> 38 <div style="height: 100px"></div> 39 </div> 40 </body> 41 </html>