Status: PASS | Duration: 5ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi
/css/css-anchor-position/anchor-scroll-fixedpos-003.html
<!DOCTYPE html> <title>Tests that fixed-positioned anchor-positioned elements doesn't get clipped by the viewport</title> <link rel="author" href="mailto:kiet.ho@apple.com"> <link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/"> <link rel="match" href="reference/anchor-scroll-fixedpos-003-ref.html"> <style> body { margin: 0; } div { width: 100px; height: 100px; font-size: 16px; } #anchor { anchor-name: --a1; margin-top: 105vh; background: orange; } #anchored { position: fixed; position-anchor: --a1; left: anchor(left); bottom: anchor(top); background: green; color: white; } </style> <body> <div id="anchor"></div> <div id="anchored"></div> <script> const anchor = document.getElementById("anchor"); anchor.scrollIntoView(false); </script> </body>
/css/css-anchor-position/reference/anchor-scroll-fixedpos-003-ref.html
<!DOCTYPE html> <style> body { margin: 0; } div { width: 100px; height: 100px; font-size: 16px; background: green; color: white; } #anchor { margin-top: 105vh; background: orange; } #anchored { position: absolute; top: calc(105vh - 100px); background: green; } </style> <body> <div id="anchor"></div> <div id="anchored"></div> <script> const anchor = document.getElementById("anchor"); anchor.scrollIntoView(false); </script> </body>