<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#anchor-pos">
<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#anchor-size">
<link rel="author" href="mailto:[email protected]">
<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>
.cb {
position: relative;
}
.columns {
column-count: 3;
column-fill: auto;
column-gap: 10px;
width: 620px;
height: 100px;
}
.grid {
display: grid;
grid-template-columns: repeat(2, 100px);
grid-template-rows: 50px 100px;
}
.spacer {
background: yellow;
}
.anchor1 {
anchor-name: --a1;
grid-column: 2;
grid-row: 2;
border: 2px solid orange;
border-width: 5px 6px 7px 8px;
}
.target {
grid-column: 2;
grid-row: 2;
position: absolute;
width: anchor-size(--a1 width);
height: anchor-size(--a1 height);
background: lime;
opacity: .2;
}
.target1-l {
left: anchor(--a1 left);
top: anchor(--a1 top);
width: 8px;
}
.target1-r {
right: anchor(--a1 right);
bottom: anchor(--a1 bottom);
width: 6px;
}
.target1-t {
left: anchor(--a1 left);
top: anchor(--a1 top);
height: 5px;
}
.target1-b {
right: anchor(--a1 right);
bottom: anchor(--a1 bottom);
height: 5px;
}
</style>
<body onload="checkLayoutForAnchorPos('.target')">
<div>
<div class="spacer" style="height: 10px"></div>
<div class="columns">
<div class="spacer" style="height: 10px"></div>
<div class="grid cb">
<div>1</div>
<div>2</div>
<div>3</div>
<div class="anchor1"></div>
<div class="target target1-l" data-offset-x=100 data-expected-height=100></div>
<div class="target target1-r" data-offset-x=404 data-expected-height=100></div>
<div class="target target1-t" data-offset-y=0 data-expected-width=310></div>
<div class="target target1-b" data-offset-y=95 data-expected-width=310></div>
</div>
</div>
</div>
</body>