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

The explicit height makes the free space in the second row visible. Auto-height grids usually size themselves from their content.

HTML
<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

ClassCSS declarations
grid-rows-1grid-template-rows: repeat(1, minmax(0, 1fr));
grid-rows-2grid-template-rows: repeat(2, minmax(0, 1fr));
grid-rows-3grid-template-rows: repeat(3, minmax(0, 1fr));
grid-rows-[auto_1fr]grid-template-rows: auto 1fr;
grid-rows-nonegrid-template-rows: none;
grid-rows-subgridgrid-template-rows: subgrid;
View full generated CSS
Compiled 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;
}