fixed-pos-scrolled-clip-2-ref.html (739B)
1 <!DOCTYPE html> 2 <html> 3 4 <title>Reference for: position:fixed should not be clipped by the subframe clip, but it should be clipped by the "clip" clip, and the "clip" clip should be moved by the subframe.</title> 5 6 <style> 7 8 body { 9 margin: 0; 10 height: 4000px; 11 } 12 13 .subframe { 14 margin-top: 300px; 15 width: 400px; 16 height: 400px; 17 overflow: auto; 18 } 19 20 .subframeScrolled { 21 height: 800px; 22 } 23 24 .greenSquare { 25 position: absolute; 26 top: 150px; 27 left: 100px; 28 width: 200px; 29 height: 200px; 30 background: lime; 31 } 32 33 </style> 34 35 <div class="subframe"> 36 <div class="subframeScrolled"></div> 37 </div> 38 39 <div class="greenSquare"></div> 40 41 <script> 42 43 document.documentElement.scrollTop = 50; 44 document.querySelector('.subframe').scrollTop = 150; 45 46 </script>