anchor-position-top-layer-ref.html (479B)
1 <!DOCTYPE html> 2 <title>Tests anchor positioning with top-layer elements</title> 3 4 <style> 5 body { 6 margin: 0; 7 height: 300vh; 8 } 9 10 #anchor { 11 position: fixed; 12 top: 200px; 13 left: 200px; 14 width: 100px; 15 height: 100px; 16 background: orange; 17 } 18 19 #target { 20 position: fixed; 21 top: 200px; 22 left: 300px; 23 width: 100px; 24 height: 100px; 25 background: lime; 26 } 27 </style> 28 29 <div id="anchor"></div> 30 <div id="target"></div> 31 32 <script> 33 document.scrollingElement.scrollTop = 100; 34 </script>