Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>Tests anchors on out-of-flow boxes</title>
<link rel="author" href="mailto:kojii@chromium.org">
<link rel="author" href="mailto:mstensho@chromium.org">
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
<style>
.relpos {
position: relative;
}
.columns {
columns: 2;
column-fill: auto;
column-gap: 10px;
width: 170px;
height: 50px;
}
.anchor1 {
anchor-name: --a1;
position: absolute;
width: 10px;
height: 30px;
background: red;
}
.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;
}
.first {
.target.inside::before {
width: 100%;
height: 100%;
}
}
.second {
.target.inside::before {
width: 100%;
height: 50%;
}
.target.inside.part2::before {
top: 50%;
}
}
.target.outside::before {
width: calc(50% - 10px);
height: 100%;
}
.target.outside.part1::before {
left: 10px;
}
.target.outside.part2::before {
right: 10px;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="width:100px; height:100px; background:red;">
<div class="relpos first">
<div class="columns">
<div class="relpos">
<div style="width:10px; height:30px; background:green;"></div>
<div class="anchor1"></div>
<div style="height:30px;"></div>
<div style="width:10px; height:40px; background:green;"></div>
<div class="target inside"></div>
</div>
<div class="target outside part1"></div>
</div>
<div class="target outside part2"></div>
</div>
<div class="relpos second">
<div class="columns">
<div style="width:10px; height:10px; background:green;"></div>
<div class="relpos">
<div style="width:10px; height:10px; background:green;"></div>
<div class="relpos">
<div style="width:10px; height:10px; background:green;"></div>
<div class="anchor1"></div>
<div style="height:30px;"></div>
<div style="width:10px; height:40px; 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>
</div>