<main>
<div class="wrapper">
<article class="flow">
<h1>Repeating fixed size tracks</h1>
<figure class="callout">
<p>In this example there will be as many tracks as will fit into the container with a fixed size of 200px. Resize the editor panel to see the grid change.</p>
<p><code>grid-template-columns: repeat(auto-fill, 200px);</code></p>
</figure>
<div class="container" id="container">
<div class="box">Item one</div>
<div class="box">Item two</div>
<div class="box">Item three</div>
<div class="box">Item four</div>
<div class="box">Item five</div>
<div class="box">Item six</div>
<div class="box">Item seven</div>
<div class="box">Item eight</div>
</div>
</article>
</div>
</main>
:root {
--var-col: 1fr;
}
.container {
display: grid;
grid-template-columns: repeat(auto-fill, 200px);
gap: 10px;
background-color: var(--color-stroke);
padding: 1em;
max-width: 70rem;
}
select {
min-width: unset;
}
This Pen doesn't use any external JavaScript resources.