Browse documentation
Reference / Flexbox & grid
Grid template rows
Set the row tracks of a grid. A fixed-height preview can reserve flexible space below a compact heading.
Working example
Cover study
Artwork
The explicit height makes the free space in the second row visible. Auto-height grids usually size themselves from their content.
<div class="grid h-28 grid-rows-[auto_1fr] gap-1">
<h3 class="border px-2">Cover study</h3>
<div class="grid place-items-center bg-neutral-200">Artwork</div>
</div>Class reference
| Class | CSS declarations |
|---|---|
grid-rows-1 | grid-template-rows: repeat(1, minmax(0, 1fr)); |
grid-rows-2 | grid-template-rows: repeat(2, minmax(0, 1fr)); |
grid-rows-3 | grid-template-rows: repeat(3, minmax(0, 1fr)); |
grid-rows-[auto_1fr] | grid-template-rows: auto 1fr; |
grid-rows-none | grid-template-rows: none; |
grid-rows-subgrid | grid-template-rows: subgrid; |
View full generated CSS
.grid-rows-1 {
grid-template-rows: repeat(1, minmax(0, 1fr));
}
.grid-rows-2 {
grid-template-rows: repeat(2, minmax(0, 1fr));
}
.grid-rows-3 {
grid-template-rows: repeat(3, minmax(0, 1fr));
}
.grid-rows-\[auto_1fr\] {
grid-template-rows: auto 1fr;
}
.grid-rows-none {
grid-template-rows: none;
}
.grid-rows-subgrid {
grid-template-rows: subgrid;
}