initial-1-ref.html (680B)
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 <link rel="author" title="Corey Ford" href="mailto:cford@mozilla.com"> 7 <style> 8 body { 9 height: 100px; 10 margin: 0; 11 /* Without this, we do multiple passes of reflow, and 12 * the sticky element ends up positioned correctly. 13 */ 14 overflow-y: scroll; 15 } 16 #sticky { 17 position: relative; 18 top: 10px; 19 height: 10px; 20 margin-bottom: 10px; 21 background-color: black; 22 } 23 </style> 24 <body> 25 <div id="sticky"></div> 26 </body> 27 </html>