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-scroll-position-try-015.tentative.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Scrolling further up shouldn't trigger the anchored element to grow.</title>
<link rel="match" href="anchor-scroll-position-try-015-ref.html">
<style>
#anchor {
anchor-name: --a;
margin-top: 200px;
width: 100px;
height: 100px;
background: blue;
}
#anchored {
position: absolute;
position-anchor: --a;
position-area: top center;
position-try-fallbacks: flip-block;
width: 100%;
height: 100%;
min-height: 100px;
background: green;
}
</style>
<div style="position:relative; width:200px; height:300px;">
<div id="scroller" style="overflow:scroll; scrollbar-width:none; width:100%; height:100%;">
<div id="anchor"></div>
<div style="width:1000px; height:1000px;"></div>
<div id="anchored"></div>
</div>
</div>
<script>
scroller.scrollTop = 150;
requestAnimationFrame(() => {
requestAnimationFrame(() => {
scroller.scrollTop = 200;
document.documentElement.classList.remove('reftest-wait');
});
});
</script>