contain-layout-021.html (848B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>CSS Containment Test: Layout containment fixed positioned descendants</title> 4 <link rel="help" href="https://drafts.csswg.org/css-contain-1/#containment-layout"> 5 <link rel="match" href="reference/contain-layout-021-ref.html"> 6 <meta name=assert content="Layout containment makes an element to act as containing block for fixed positioned descendants."> 7 <style> 8 html { 9 contain: layout; 10 } 11 #fixed { 12 position: fixed; 13 background: green; 14 width: 100px; 15 height: 100px; 16 } 17 body { 18 height: 3000px; 19 margin: 0px; 20 } 21 #spacer { 22 height: 200px; 23 } 24 </style> 25 <script> 26 function runTest() { 27 document.documentElement.scrollTop += 200; 28 } 29 </script> 30 <body onload="runTest()"> 31 <div id="spacer"></div> 32 <p>Test passes if there is a filled green square and <strong>no red</strong>.</p> 33 <div id="fixed"></div> 34 </body>