<!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>

    <!-- Basic cases of all `anchor-size`s. -->
    <div class="target" style="width: anchor-size(--a1 width)" data-expected-width=5></div>
    <div class="target" style="height: anchor-size(--a1 height)" data-expected-height=7></div>
    <div class="target" style="width: anchor-size(--a1 inline)" data-expected-width=5></div>
    <div class="target" style="height: anchor-size(--a1 block)" data-expected-height=7></div>
    <div class="target" style="width: anchor-size(--a1 self-inline)" data-expected-width=5></div>
    <div class="target" style="height: anchor-size(--a1 self-block)" data-expected-height=7></div>

    <!-- Different axes should work. -->
    <div class="target" style="height: anchor-size(--a1 width)" data-expected-height=5></div>
    <div class="target" style="width: anchor-size(--a1 height)" data-expected-width=7></div>
    <div class="target" style="height: anchor-size(--a1 inline)" data-expected-height=5></div>
    <div class="target" style="width: anchor-size(--a1 block)" data-expected-width=7></div>
    <div class="target" style="height: anchor-size(--a1 self-inline)" data-expected-height=5></div>
    <div class="target" style="width: anchor-size(--a1 self-block)" data-expected-width=7></div>
  </div>
</body>
