anchor { anchor-name: --a; }
  #anchored {
    width: 50px;
    height: 50px;
    background: skyblue;
    animation: --anim 1s steps(2, start);
    position: absolute;
    position-anchor: --a;
  }
  @keyframes --anim {
    from { top: anchor(top); }
    to { top: anchor(bottom); }
  }
</style>
<div id=cb>
  <div id=a1 class=anchor></div>
  <div id=a2></div>
  <div id=anchored></div>
</div>
<script>
  test(() => {
    assert_equals(anchored.offsetTop, 50);
    a1.classList.toggle('anchor');
    a2.classLis