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-child-transition.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Anchor Positioning Test: Transition on anchored element child with anchored() query</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#anchor {
anchor-name: --a;
}
#container {
container-type: anchored;
position: absolute;
position-anchor: --a;
position-area: top;
position-try-fallbacks: flip-block;
}
#child {
scale: 1;
}
#child.large {
scale: 2;
}
@container anchored(fallback: flip-block) {
#child {
transition: scale 1000s steps(2, start);
}
}
</style>
<div id="anchor"></div>
<div id="container">
<div id="child"></div>
</div>
<script>
test(() => {
assert_equals(getComputedStyle(child).scale, "1");
}, "Initial scale is 1");
test(() => {
container.style.height = "200px"; // Trigger fallback which sets the transition property
child.classList.toggle("large"); // Trigger scale transition
assert_equals(getComputedStyle(child).scale, "1.5");
}, "Start transition of scale property on anchored child");
</script>