| <!DOCTYPE html> |
| <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"></div> |
| </div> |
| |
| <div class="cb"> |
| <div class="scroller"> |
| <div class="anchor"></div> |
| </div> |
| <div class="target no-clip"></div> |
| </div> |