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-fixedpos-nested-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>Fixed-positioned element nested in anchor-scroll-adjusted container doesn't double-compensate for viewport scroll</title>
<link rel="author" href="mailto:fantasai@inkedblade.net">
<link rel="match" href="reference/anchor-scroll-fixedpos-nested-001-ref.html">
<style>
body {
margin: 0;
width: 1000px;
height: 1000px;
}
div {
width: 50px;
height: 50px;
}
#anchor1 {
position: absolute;
left: 150px;
top: 150px;
anchor-name: --a1;
background: orange;
}
#anchor2 {
position: absolute;
left: 250px;
top: 250px;
anchor-name: --a2;
background: teal;
}
#f1 {
position: fixed;
position-anchor: --a1;
position-area: bottom right;
background: yellow;
}
#f2 {
position: fixed;
position-anchor: --a2;
position-area: bottom right;
background: aqua;
}
#f3 {
position: fixed;
position-anchor: --a1;
position-area: bottom right;
margin-top: 100px;
background: aqua;
}
</style>
<div id="anchor1"></div>
<div id="anchor2"></div>
<div id="f1">
<div id="wrapper">
<div id="f2"></div>
<div id="f3"></div>
</div>
</div>
<script>
document.documentElement.scrollLeft = 100;
document.documentElement.scrollTop = 100;
</script>