position-absolute-dynamic-static-position-floats-004.html (1091B)
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 direction: rtl; 12 13 box-sizing: border-box; 14 border: solid green 10px; 15 width: 100px; 16 height: 100px; 17 } 18 19 #float { 20 float: right; 21 background: green; 22 23 width: 40px; 24 height: 80px; 25 } 26 27 #target { 28 position: absolute; 29 background: green; 30 display: inline; 31 32 width: 40px; 33 height: 80px; 34 top: -10px; 35 left: -10px; 36 } 37 </style> 38 <p>Test passes if there is a filled green square.</p> 39 <div id="container"> 40 <div id="float"></div> 41 <div id="target"></div> 42 </div> 43 <script> 44 document.body.offsetTop; 45 const target = document.getElementById('target'); 46 target.style.top = 'initial'; 47 target.style.left = 'initial'; 48 document.body.offsetTop; 49 takeScreenshot(); 50 </script>