Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-grid/grid-definition/grid-auto-fit-empty-repeat-range-001.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="match" href="grid-auto-fit-empty-repeat-range-001-ref.html">
<meta name="assert" content="When every track generated by repeat(auto-fit) is empty, they all collapse and only one gutter remains between the fixed tracks around them.">
<style>
.grid {
display: grid;
width: 400px;
background: lightgray;
column-gap: 10px;
grid-template-columns: 30px repeat(auto-fit, 40px) 70px;
}
.item {
height: 50px;
background: green;
}
</style>
<!-- 5 repetitions fit, so the grid has 7 tracks. The items are only in the first and last, fixed tracks. -->
<div class="grid">
<div class="item" style="grid-column: 1"></div>
<div class="item" style="grid-column: 7"></div>
</div>