Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 1 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-conditional/container-queries/var-evaluation.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Container Queries Test: var() in size query values</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/cq-testcommon.js"></script>
<style>
#container {
container-type: size;
width: 200px;
--query: 100px;
--invalid-value: initial;
}
@container (width > var(--invalid-value, var(--query, 500px))) {
#target {
height: 50px;
background-color: green;
}
}
</style>
<div id=container>
<div id=target></div>
</div>
<script>
setup(() => assert_implements_size_container_queries());
test(() => {
assert_equals(getComputedStyle(target).backgroundColor, 'rgb(0, 128, 0)');
}, 'inline-size with var-substitution');
</script>