ne-height: 1;
  width: 10em;
}
#anchor1 {
  anchor-name: --a1;
}
.target {
  position: absolute;
}
</style>
<body onload="checkLayoutForAnchorPos('.target')">
  <div id="container">
    <div>spacer</div>
    <div>
      <br>
      0123<span id="anchor1">456</span>78
    </div>

    <div class="target" style="left: anchor(--a1 left)" data-offset-x=40></div>
    <div class="target" style="right: anchor(--a1 right)" data-offset-x=70></div>
    <div class="target" style="top: anchor(--a1 top)" data-offset-y=20>