wpt / css / css-anchor-position / no-anchor-anchor-center.html

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

/css/css-anchor-position/no-anchor-anchor-center.html

<!doctype html>
<title>Tests that 'anchor-center' behaves as 'center' when no anchor in containing block</title>
<link rel="match" href="no-anchor-anchor-center-ref.html">
<link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#valdef-justify-self-anchor-center">
<style>
.anchor {
  anchor-name: --dropdownAnchor;
  background: orange;
  width: 100px;
  background-color: orange;
}
.container {
  position: fixed;
  top: 20px;
  left: 50px;
  width: 300px;
  height: 200px;
  background: green;
}
.target {
  position-anchor: --dropdownAnchor;
  display: flow;
  left: 10px;
  right: 10px;
  position: absolute;
  justify-self: anchor-center;
  width: 80px;
  border: 1px #000 solid;
  background: lime;
}
</style>
<div class="anchor">anchor</div>
<div class="container">
  <div class="target">target 1</div>
</div>

/css/css-anchor-position/no-anchor-anchor-center-ref.html

<!doctype html>
<title>Tests that 'anchor-center' behaves as 'center' when no anchor in containing block</title>
<style>
.anchor {
  background: orange;
  width: 100px;
  background-color: orange;
}
.container {
  position: fixed;
  top: 20px;
  left: 50px;
  width: 300px;
  height: 200px;
  display: flex;
  background: green;
  justify-content: center;
}
.target {
  position: absolute;
  margin: 0 auto;
  width: 80px;
  border: 1px #000 solid;
  background: lime;
}
</style>
<div class="anchor">anchor</div>
<div class="container">
  <div class="target">target 1</div>
</div>