CSS grid-template-rows Property Explained

What the CSS grid-template-rows property does, with an example.

Published November 4, 2026

grid-template-rows defines the row tracks of a grid. Unspecified rows are created automatically with grid-auto-rows.

How it works

Use fixed sizes, fr, auto or minmax() for rows. A typical page layout uses auto for header and footer and 1fr for the content.

Explicit rows plus grid-auto-rows control extra rows.

Values and effects

grid-template-rows: auto 1fr auto; → header, flexible content, footer
grid-template-rows: repeat(3, 100px); → three fixed rows
grid-template-rows: minmax(100px, auto); → at least 100px, grow with content

Practical examples

Full-height layout

.app { display: grid; grid-template-rows: auto 1fr auto; min-height: 100vh; }

Fixed gallery rows

.gallery { display: grid; grid-template-rows: repeat(2, 200px); }

Auto rows

.list { display: grid; grid-auto-rows: minmax(60px, auto); }

Common mistakes

  • Forgetting a height so 1fr has no space to share.
  • Content overflowing fixed-height rows.
  • Confusing explicit and implicit rows.

Key takeaways

  • grid-template-rows in one line: grid-template-rows defines the row tracks of a grid.
  • Inspect it live in DevTools → Styles.
  • Test across browsers and screen sizes.

FAQ

What is grid-auto-rows?

The size of rows created implicitly when items exceed the explicit rows.

Is grid-template-rows supported in all browsers?

Yes in all modern browsers; check caniuse.com for edge cases.

More CSS articles