| <!DOCTYPE html> |
| <html class="reftest-wait"> |
| <title>Tests changing the value of the 'anchor-clip' property</title> |
| <link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#anchor-clip"> |
| <link rel="match" href="anchor-clip-004-ref.html"> |
| <link rel="author" href="mailto:xiaochengh@chromium.org"> |
| |
| <style> |
| .cb { |
| position: relative; |
| margin-block: 50px; |
| } |
| |
| .scroller { |
| overflow-x: scroll; |
| width: 200px; |
| height: 200px; |
| } |
| |
| .anchor { |
| width: 100px; |
| height: 100px; |
| margin-right: 300px; |
| anchor-name: --a; |
| background: orange; |
| } |
| |
| .target { |
| position: absolute; |
| width: 100px; |
| height: 100px; |
| background: lime; |
| anchor-default: --a; |
| top: anchor(top); |
| left: calc(anchor(right) + 100px); |
| } |
| |
| .no-clip { |
| anchor-clip: none; |
| } |
| </style> |
| |
| <div class="cb"> |
| <div class="scroller"> |
| <div class="anchor"></div> |
| </div> |
| <div class="target no-clip"></div> |
| </div> |
| |
| <div class="cb"> |
| <div class="scroller"> |
| <div class="anchor"></div> |
| </div> |
| <div class="target"></div> |
| </div> |
| |
| <script type="module"> |
| function raf() { return new Promise(resolve => requestAnimationFrame(resolve)); } |
| |
| await raf(); |
| await raf(); |
| document.querySelectorAll('.target').forEach(target => target.classList.toggle('no-clip')); |
| document.documentElement.classList.remove('reftest-wait'); |
| </script> |
| |
| </html> |