Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>Anchors on fixed positioned objects in multicol</title>
<link rel="author" href="mailto:kojii@chromium.org">
<link rel="author" href="mailto:mstensho@chromium.org">
<link rel="match" href="anchor-position-multicol-fixed-001-ref.html">
<style>
.transform {
transform: translate(0);
}
.columns {
columns: 2;
column-fill: auto;
column-gap: 10px;
width: 210px;
height: 50px;
}
.colspan {
column-span: all;
}
.spacer {
height: 10px;
}
.anchor1 {
anchor-name: --a1;
margin-left: 10px;
width: 40px;
height: 10px;
}
.anchor2 {
anchor-name: --a1;
position: fixed;
left: 20px;
top: 20px;
width: 20px;
height: 30px;
}
.target {
position: absolute;
left: anchor(--a1 left);
top: anchor(--a1 top);
width: anchor-size(--a1 width);
height: anchor-size(--a1 height);
}
.target::before {
position: absolute;
content: "";
background: green;
}
.target.inside::before {
width: 100%;
height: 50%;
}
.target.inside.part2::before {
top: 50%;
}
.target.outside::before {
width: calc(50% - 20px);
height: 100%;
}
.target.outside.part1::before {
left: 20px;
}
.target.outside.part2::before {
right: 20px;
}
</style>
<p>There should be a green rectangle below, no red.</p>
<div class="transform">
<div style="height:10px;"></div>
<div style="position:absolute; z-index:-1; left:20px; width:130px; height:50px; background:red;"></div>
<div class="columns">
<div class="transform">
<div style="margin-left:20px; width:20px; height:20px; background:green;"></div>
<div class="transform">
<div style="margin-left:20px; width:20px; height:20px; background:green;"></div>
<div class="anchor1"></div>
<div class="anchor2"></div>
<div style="height:20px;"></div>
<div style="margin-left:20px; width:20px; height:30px; background:green;"></div>
<div class="target inside part1"></div>
</div>
<div class="target inside part2"></div>
</div>
<div class="target outside part1"></div>
</div>
<div class="target outside part2"></div>
</div>