container-units-in-at-container-dynamic.html (1020B)
1 <!doctype html> 2 <title>Container Relative Units: in @container prelude (dynamic)</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-lengths"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="support/cq-testcommon.js"></script> 7 <style> 8 #outer { 9 container-type: size; 10 width: 40px; 11 height: 40px; 12 } 13 #container { 14 container-type: size; 15 width: 16px; 16 height: 16px; 17 } 18 19 @container ((width = 16px) and (width = 50cqw)) { #child { --cqw:true; } } 20 21 </style> 22 23 <div id=outer> 24 <div id=container> 25 <div id=child>Test</div> 26 </div> 27 </div> 28 29 <script> 30 setup(() => assert_implements_size_container_queries()); 31 32 test(() => { 33 assert_equals(getComputedStyle(child).getPropertyValue('--cqw'), ''); 34 outer.style.width = '32px'; 35 assert_equals(getComputedStyle(child).getPropertyValue('--cqw'), 'true'); 36 }, 'Query with container-relative units are responsive to changes'); 37 </script>