Source code

Revision control

Copy as Markdown

Other Tools

Test Info:

<!DOCTYPE html>
<title>CSS stretch(): the maximum block size an auto-repeat grid container fits its repetitions into</title>
<link rel="match" href="../reference/ref-filled-green-100px-square.xht" />
<meta name="assert" content="A stretch() maximum size fits the grid container's margin box to its argument, and the auto-fill repetitions fit into the content box that leaves.">
<style>
#reference-overlapped-red {
position: absolute;
background-color: red;
width: 100px;
height: 100px;
z-index: -1;
}
.grid {
display: grid;
grid-template-rows: repeat(auto-fill, 50px);
grid-auto-flow: column;
grid-auto-columns: 50px;
width: 100px;
max-height: stretch(150px);
margin-bottom: 50px;
}
.grid > div {
background: green;
}
</style>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div id="reference-overlapped-red"></div>
<!-- Two 50px repetitions fit into the 100px content box, so the four items take two columns. -->
<div class="grid"><div></div><div></div><div></div><div></div></div>