left-3.html (1335B)
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 - left, contained</title> 7 <link rel="author" title="Corey Ford" href="mailto:cford@mozilla.com"> 8 <link rel="match" href="left-3-ref.html"> 9 <meta name="flags" content="dom"> 10 <meta name="assert" content="Sticky-left with too much scrolling: should stay within the containing block"> 11 <style> 12 #scroll { 13 width: 100px; 14 height: 100px; 15 overflow: hidden; 16 border: 1px solid black; 17 white-space: nowrap; 18 } 19 #scroll div { 20 display: inline-block; 21 } 22 .fill { 23 width: 100px; 24 height: 1px; 25 } 26 #contain { 27 width: 200px; 28 height: 10px; 29 background-color: gray; 30 } 31 #sticky { 32 position: sticky; 33 left: 10px; 34 width: 10px; 35 height: 10px; 36 background-color: black; 37 } 38 </style> 39 <body> 40 <div id="scroll"> 41 <div class="fill"></div 42 ><div id="contain"> 43 <div id="sticky"></div> 44 </div 45 ><div class="fill"></div> 46 </div> 47 <script type="text/javascript"> 48 document.getElementById("scroll").scrollLeft = 295; 49 </script> 50 </body> 51 </html>