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-anchor-position/container-queries/anchored-fallback-implicit-any.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Conditional Test: @container anchored(fallback) matching implicit 'any' <position-area></title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script>
<style>
#anchor {
anchor-name: --a;
width: 100px;
height: 100px;
}
#anchored {
position: absolute;
position-anchor: --a;
position-area: top;
position-try-fallbacks: right span-bottom;
width: 100px;
/* Too tall to fit over the anchor to trigger fallback */
height: 100px;
container-type: anchored;
}
#target {
/* Implicit 'any' for the horizontal part of the query */
@container anchored(fallback: span-bottom) { --span-bottom: yes; }
/* Implicit 'any' for the vertical part of the query */
@container anchored(fallback: right) { --right: yes; }
}
</style>
<div id="anchor"></div>
<div id="anchored">
<div id="target"></div>
</div>
<script>
test(() => {
const style = getComputedStyle(target);
assert_equals(style.getPropertyValue("--span-bottom"), "yes");
assert_equals(style.getPropertyValue("--right"), "yes");
}, "@container anchored(fallback: <position-area>) querying single axis with implicit 'any'");
</script>