position-absolute-abspos-table-dynamic.html (940B)
1 <!DOCTYPE html> 2 <title>CSS Position: dynamic abspos table height changes</title> 3 <link rel="author" title="mailto:atotic@google.com"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <link rel="help" href="https://www.w3.org/TR/css-position-3/#abs-non-replaced-height"> 7 <meta name="assert" content="Height changes for abspos table."> 8 <style> 9 10 #container { 11 width: 400px; 12 height: 300px; 13 background: green; 14 position: relative; 15 } 16 #target { 17 display: table; 18 background: red; 19 position: absolute; 20 top: 0; 21 width: 50%; 22 height: 100px; 23 } 24 </style> 25 <!-- There should be no red on this page --> 26 <div id="container"> 27 <div id="target"></div> 28 </div> 29 <script> 30 document.body.offsetTop; 31 let target = document.querySelector("#target"); 32 target.style.height = "auto"; 33 test(() => { 34 assert_equals(window.getComputedStyle(target).height, "0px"); 35 }, '#target height changed'); 36 </script>