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/sticky-anchor-position-invalid.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Anchor queries in sticky positioning is invalid</title>
<link rel="author" href="mailto:xiaochengh@chromium.org">
<link rel="match" href="reference/sticky-anchor-position-invalid-ref.html">
<style>
#scroll-container {
width: 200px;
height: 200px;
overflow-y: scroll;
}
#scroller {
height: 400px;
}
#sticky {
position: sticky;
height: 150px;
background: green;
top: anchor(--invalid top, 42px); /* Should use the fallback */
}
</style>
<div id="scroll-container">
<div id="scroller">
<div id="sticky">
</div>
</div>
</div>
<script>
document.getElementById("scroll-container").scrollTop = 50;
</script>