wpt / css / css-anchor-position / anchor-name-005.html

Status: FAIL | Duration: 12ms | Subtests: 0/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-anchor-position/anchor-name-005.html

<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#determining">
<link rel="author" href="mailto:kiet.ho@apple.com">
<link rel="match" href="reference/anchor-name-005-ref.html">
<meta name="assert" content="An anchor element with multiple anchor names can be referenced using both names">
<style>
#anchor {
  position: relative;
  top: 10px;
  left: 10px;

  anchor-name: --a1, --a2;
  width: 100px;
  height: 100px;
  background: red;
}
#target {
  position: absolute;
  /* if this fails, the target (green) box is displayed below the anchor (red) box */
  top: anchor(--a1 top);
  /* if this fails, the target box will not fully cover the anchor box */
  left: anchor(--a2 left);

  width: 100px;
  height: 100px;
  background: green;
  z-index: 1;
}
</style>
<body>
  <p>The test passes if there is only one green square with no red.</p>
  <div>
    <div>
        <div id="anchor"></div>
    </div>
    <div id="target"></div>
  </div>
</body>

/css/css-anchor-position/reference/anchor-name-005-ref.html

<!DOCTYPE html>
<style>
#green {
  position: relative;
  top: 10px;
  left: 10px;

  width: 100px;
  height: 100px;
  background: green;
}
</style>
<body>
  <p>The test passes if there is only one green square with no red.</p>
  <div id="green"></div>
</body>