Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-conditional/container-queries/style-query-with-unknown-width.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Container Queries Test: style and size query against container without a principal box</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/cq-testcommon.js"></script>
<style>
#container {
container-type: inline-size;
display: contents;
--foo: bar;
}
@container (width >= 0px) or style(--foo: bar) {
#target { color: green; }
}
</style>
<div id="container">
<div id="target">Should be green</div>
</div>
<script>
setup(() => {
assert_implements_style_container_queries();
assert_implements_size_container_queries();
});
test(() => {
assert_equals(getComputedStyle(target).color, "rgb(0, 128, 0)");
}, "width query should evaluate to unknown and style query to true");
</script>