Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test has a WPT meta file that expects 5 subtest issues.
- This WPT test may be referenced by the following Test IDs:
- /css/css-anchor-position/anchor-position-003.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<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>
.cb {
position: relative;
}
.not-positioned-cb {
transform: translate(0, 0); /* Make it a containing block. */
}
.anchor1 {
anchor-name: --a1;
}
.size5x7 {
width: 5px;
height: 7px;
background: orange;
}
.size9x11 {
width: 9px;
height: 11px;
background: blue;
}
.target {
position: absolute;
}
</style>
<!--
To determine the target anchor element, find the last acceptable anchor
element el in tree order.
-->
<body onload="checkLayoutForAnchorPos('.target')">
<div class="cb">
<div class="anchor1 size5x7"></div>
<div class="anchor1 size9x11"></div>
<div class="target" style="left: anchor(--a1 right)" data-offset-x=9></div>
</div>
<div class="cb">
<div class="anchor1 size5x7">
<div class="anchor1 size9x11"></div>
<div class="target" style="left: anchor(--a1 right)" data-offset-x=9></div>
</div>
<div class="target" style="left: anchor(--a1 right)" data-offset-x=9></div>
</div>
<div class="cb">
<div class="anchor1 size5x7 not-positioned-cb">
<div class="anchor1 size9x11"></div>
<div class="target" style="left: anchor(--a1 right)" data-offset-x=9></div>
</div>
<div class="target" style="left: anchor(--a1 right)" data-offset-x=9></div>
</div>
</body>