viewport-units.html (1085B)
1 <!doctype html> 2 <title>CSS Container Queries Test: viewport units</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#size-container"> 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 #vw { container-type: inline-size; width: 10vw; } 9 #vh { container-type: inline-size; width: 10vh; } 10 11 @container (min-width: 10vw) { 12 #vw span { color: green } 13 } 14 @container (min-width: 11vw) { 15 #vw span { color: red } 16 } 17 @container (min-width: 10vh) { 18 #vh span { color: green } 19 } 20 @container (min-width: 11vh) { 21 #vh span { color: red } 22 } 23 </style> 24 <div id="vw"><span>Green</span></div> 25 <div id="vh"><span>Green</span></div> 26 <script> 27 setup(() => assert_implements_size_container_queries()); 28 29 const green = "rgb(0, 128, 0)"; 30 31 test(() => assert_equals(getComputedStyle(vw.firstChild).color, green), "Match width with vw"); 32 test(() => assert_equals(getComputedStyle(vh.firstChild).color, green), "Match width with vh"); 33 </script>