position-absolute-dynamic-static-position-floats-003.html (1151B)
1 <!DOCTYPE html> 2 <html class='reftest-wait'> 3 <link rel="match" href="../reference/ref-filled-green-100px-square-only.html"> 4 <link rel="help" href="https://www.w3.org/TR/css-position-3/" /> 5 <meta name="assert" content="This test checks that a dynamic change in constraints calculates the static position correctly."/> 6 <script src="/common/reftest-wait.js"></script> 7 <style> 8 #container { 9 position: relative; 10 background: red; 11 12 box-sizing: border-box; 13 border: solid green 10px; 14 width: 100px; 15 height: 100px; 16 } 17 18 #float { 19 float: left; 20 background: green; 21 22 width: 40px; 23 height: 80px; 24 } 25 26 #block { 27 background: green; 28 height: 40px; 29 } 30 31 #target { 32 position: absolute; 33 background: green; 34 display: inline; 35 36 width: 40px; 37 height: 40px; 38 top: -10px; 39 left: -10px; 40 } 41 </style> 42 <p>Test passes if there is a filled green square.</p> 43 <div id="container"> 44 <div id="block"> 45 <div id="float"></div> 46 </div> 47 <div id="target"></div> 48 </div> 49 <script> 50 document.body.offsetTop; 51 const target = document.getElementById('target'); 52 target.style.top = 'initial'; 53 target.style.left = 'initial'; 54 document.body.offsetTop; 55 takeScreenshot(); 56 </script>