Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<meta charset="utf-8">
<link rel="match" href="grid-auto-fit-collapsed-out-of-flow-003-ref.html">
<meta name="assert" content="The grid area of an absolutely-positioned descendant of a grid container accounts for collapsed auto-fit rows and their collapsed gutters.">
<style>
.grid {
display: grid;
position: relative;
width: 50px;
height: 300px;
background: lightgray;
row-gap: 10px;
grid-template-columns: 50px;
grid-template-rows: repeat(auto-fit, 50px);
}
.abspos {
position: absolute;
inset: 0;
background: green;
}
</style>
<!-- 5 tracks. Tracks 1, 2 (leading) and 4 (middle) are empty and collapse. -->
<div class="grid">
<div style="grid-row: 3"><div class="abspos" style="grid-row: 3 / 4"></div></div>
<div style="grid-row: 5"><div class="abspos" style="grid-row: 5 / 6"></div></div>
</div>