Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-anchor-position/anchor-position-non-anchored-fallback.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSS Anchor Positioning Test: Invalidation of fallback without anchor references</title>
<link rel="match" href="../reference/ref-filled-green-100px-square-only.html">
<style>
#anchor {
anchor-name: --anchor;
background: green;
width: 100px;
height: 100vh;
}
#anchored {
background: green;
top: anchor(--anchor bottom);
width: 100px;
height: 50px;
position: absolute;
position-try: --bottom;
}
@position-try --bottom {
top: auto;
bottom: 0px;
}
</style>
<p>Test passes if there is a filled green square.</p>
<div id="anchor"></div>
<div id="anchored"></div>
<script>
anchor.offsetTop;
anchor.style.height = "50px";
</script>