position-absolute-dynamic-static-position-floats-002.html (1146B)
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="float"></div> 45 <div id="block"></div> 46 <div id="target"></div> 47 </div> 48 <script> 49 document.body.offsetTop; 50 const target = document.getElementById('target'); 51 target.style.top = 'initial'; 52 target.style.left = 'initial'; 53 document.body.offsetTop; 54 takeScreenshot(); 55 </script>