conditional-container-status.html (991B)
1 <!doctype html> 2 <title>Conditionally removing container status</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-type"> 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 .parent { width: 300px; } 9 .child { width: 100px; } 10 .parent, .child { container-type: inline-size; } 11 @container (min-width: 200px) { 12 .child { container-type: initial; } 13 .grandchild { border: 3px solid green } 14 } 15 </style> 16 <div class="parent"> 17 <div class="child"> 18 <div class="grandchild">You should see a green border around this text</div> 19 </div> 20 </div> 21 <script> 22 setup(() => assert_implements_size_container_queries()); 23 24 test(function() { 25 let s = getComputedStyle(document.querySelector('.grandchild')); 26 assert_equals(s.getPropertyValue('border-color'), 'rgb(0, 128, 0)'); 27 }, 'Conditionally applying container-type:initial'); 28 </script>