<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#propdef-anchor-name">
<link rel="author" href="mailto:kojii@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>
<script src="support/test-common.js"></script>
<style>
.container {
  position: relative;
  height: 10px;
}
.anchor1 {
  anchor-name: --a1;
  width: 5px;
  height: 7px;
  background: orange;
}
.target {
  position: absolute;
}
</style>
<body onload="checkLayoutForAnchorPos('.target')">
  <div class="container">
    <div class="anchor1"></div>

    <div class="target"
      style="min-width: anchor-size(--a1 width)"
      data-expected-width=5></div>
    <div class="target"
      style="min-height: anchor-size(--a1 width)"
      data-expected-height=5></div>

    <div class="target"
      style="max-width: anchor-size(--a1 width)"
      data-expected-width=5>
      <div style="width: 100px"></div>
    </div>
    <div class="target"
      style="max-height: anchor-size(--a1 width)"
      data-expected-height=5>
      <div style="height: 100px"></div>
    </div>
  </div>
</body>
