Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<link rel="help" href="https://crbug.com/445458885">
<style>
#scroll-container {
overflow: hidden scroll;
width: 300px;
height: 100px;
}
#anchor1 {
anchor-name: --a1;
width: 100px;
height: 100px;
background: orange;
}
#anchor2 {
anchor-name: --a2;
width: 100px;
height: 50px;
background: yellow;
}
.spacer {
height: 100px;
}
.anchored {
position-visibility: anchors-visible;
position-area: bottom;
width: 100px;
height: 50px;
background: red;
position: absolute;
top: 0;
left: 0;
}
#chained {
position-anchor: --a1;
}
#target {
position-anchor: --a2;
}
</style>
<div id="scroll-container">
<div id="anchor1">anchor1</div>
<div class="spacer"></div>
<div id="chained" class="anchored">
<div id="anchor2">chained</div>
</div>
<div id="target" class="anchored">target</div>
</div>
<script>
requestAnimationFrame(() => {
document.getElementById('target').style.display = 'none';
});
</script>