CSS grid-auto-rows Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Layout

What You’ll Learn

The grid-auto-rows property controls how tall automatically created grid rows become when your layout needs more rows than you explicitly defined.

01

Implicit

Auto rows.

02

auto

Default size.

03

px / rem

Fixed height.

04

minmax

Min & max.

05

fr

Flexible tracks.

06

Container

Grid parent.

Introduction

The grid-auto-rows property in CSS is used to specify the size of rows in a grid container. When you create a grid layout, you may define explicit rows and columns, but any additional rows created by content will use the grid-auto-rows property to determine their size.

This property is essential for creating flexible and dynamic grid layouts that adapt to varying content sizes.

Definition and Usage

Set grid-auto-rows on a grid container alongside display: grid and grid-template-rows. Explicit rows come from your template; any extra rows the browser generates use the grid-auto-rows size. Pair with default row auto-flow when items wrap to new rows, or with explicit placement that extends beyond your template.

💡
Beginner Tip

If all items fit within your explicit row template, you may not notice grid-auto-rows. Add more items or fewer template rows to see implicit rows appear.

📝 Syntax

The syntax for the grid-auto-rows property is straightforward. You can set it using length values, percentage values, or the auto keyword:

syntax.css
.container {
  grid-auto-rows: value;
}

Basic Example

grid-auto-rows-basic.css
.container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 100px;
}
grid-auto-rows: 100px; grid-auto-rows: minmax(80px, auto); grid-auto-rows: max-content;

Default Value

The default value of the grid-auto-rows property is auto, which means that the size of the row will be determined by the content inside it.

Syntax Rules

  • Applies to grid containers only, not individual grid items.
  • Accepts one or more track sizes separated by spaces for repeating patterns.
  • Affects implicit rows only; use grid-template-rows for explicit tracks.
  • The property is not inherited.
  • Often used with grid-auto-flow and grid-template-columns for wrapping layouts.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toGrid containers
InheritedNo
ControlsImplicit row size
Related propertygrid-template-rows

💎 Property Values

ValueDescription
lengthSpecifies a fixed size for the rows, such as 100px, 2em, etc.
percentageSpecifies the size of the rows as a percentage of the grid container’s size
autoThe size of the rows is determined by the content inside them
min-contentThe size of the rows is determined by the smallest content
max-contentThe size of the rows is determined by the largest content
fit-content()A function that defines the size within a specified limit
frRepresents a fraction of the available space in the grid container

👀 Live Preview

Three columns with implicit rows at 3rem (items 4–6 on row 2, highlighted):

1
2
3
4
5
6

Examples Gallery

Set implicitly created rows to 100 pixels, then explore minmax, content keywords, and a vertical card feed.

🔢 Fixed Implicit Rows

Start with the reference example — implicit rows sized at 100 pixels.

Example 1 — 100px Auto Rows

Create a grid where each auto-generated row is 100px tall.

grid-auto-rows-100px.css
.container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 100px;
  gap: 10px;
}
Try It Yourself

How It Works

Six items in three columns create two rows. Each implicit row is exactly 100px tall, giving a uniform grid even as content wraps.

Example 2 — minmax for Flexible Implicit Rows

Let implicit rows grow between a minimum height and content size.

grid-auto-rows-minmax.css
.container {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 60px;
  grid-auto-rows: minmax(80px, auto);
}
Try It Yourself

How It Works

minmax(80px, auto) ensures implicit rows are at least 80px but can grow taller when content needs more space.

📈 Content-Based Sizing

Use content keywords when row height should follow the content inside each cell.

Example 3 — min-content vs max-content

Compare short and tall implicit row sizing based on content.

grid-auto-rows-content.css
.short-rows { grid-auto-rows: min-content; }
.tall-rows { grid-auto-rows: max-content; }
Try It Yourself

How It Works

min-content shrinks rows to the smallest fit; max-content expands rows to fit all content without clipping.

Example 4 — Vertical Card Feed

Build a single-column feed where each card row has a consistent height.

grid-auto-rows-feed.css
.feed {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 5rem;
  gap: 1rem;
}
Try It Yourself

How It Works

Each new item creates an implicit row at 5rem, giving a uniform vertical feed without setting a fixed number of rows.

♿ Accessibility

  • Do not clip important content when using fixed row heights; allow overflow or use minmax().
  • Ensure touch targets fit inside fixed-height rows on mobile devices.
  • Test zoom levels so text is not cut off in short rows.
  • Keep logical reading order when items wrap into new implicit rows.
  • Use headings inside cards rather than relying on row position alone.

🧠 How grid-auto-rows Works

1

Explicit rows are defined

grid-template-rows sets the planned row tracks.

Template
2

Extra rows are needed

Wrapping items or placement creates implicit rows beyond the template.

Implicit tracks
3

grid-auto-rows applies

Each new row uses the size you specified, such as 100px or minmax().

Sizing
=

Consistent extra rows

Implicit rows stay uniform even as the grid grows vertically.

🖥 Browser Compatibility

The grid-auto-rows property is supported in most modern browsers, including recent versions of Chrome, Firefox, Safari, Edge, and Opera.

Baseline · Modern browsers

grid-auto-rows everywhere

Implicit row sizing works in all major modern grid implementations.

97% Modern browser support
Google Chrome 57+ · Desktop & Mobile
Full support
Mozilla Firefox 52+ · Desktop & Mobile
Full support
Apple Safari 10.1+ · macOS & iOS
Full support
Microsoft Edge 16+ · 79+ Chromium
Full support
Opera 44+
Full support
grid-auto-rows property 97% supported

Bottom line: Safe for modern projects. Combine with display: grid and explicit row templates.

🎉 Conclusion

The grid-auto-rows property is a powerful tool for web developers looking to create flexible and dynamic grid layouts. By controlling the size of automatically generated rows, you can ensure that your grid adapts to varying content sizes while maintaining a consistent and visually appealing layout.

Experiment with different values to see how this property can enhance the design of your web projects. Start with fixed pixels, then try minmax() and content keywords for smarter sizing.

💡 Best Practices

✅ Do

  • Define explicit rows with grid-template-rows
  • Set grid-auto-rows for wrapping overflow
  • Use minmax() for flexible implicit tracks
  • Pair with column templates for card grids
  • Test with enough items to trigger implicit rows

❌ Don’t

  • Confuse with grid-template-rows
  • Apply on grid items instead of containers
  • Use fixed heights that clip text
  • Forget mobile zoom testing
  • Expect changes without implicit rows

Key Takeaways

Knowledge Unlocked

Five things to remember about grid-auto-rows

Use these points when sizing implicit rows.

5
Core concepts
auto 02

Default auto

Content size.

Default
100px 03

Fixed height

Length units.

Syntax
minmax 04

Flexible

Min & max.

Pattern
template 05

Explicit first

Then auto rows.

Workflow

❓ Frequently Asked Questions

grid-auto-rows sets the size of rows that are created automatically when grid items need more rows than grid-template-rows defines.
The default value is auto, which sizes implicit rows based on their content.
Explicit rows come from grid-template-rows. Implicit rows are generated when placement or auto-flow creates extra rows beyond those definitions.
grid-template-rows defines the main row tracks you plan for. grid-auto-rows only affects extra rows the browser creates when needed.
It applies when the grid creates implicit rows, such as when more items wrap to new rows or when items are placed on row lines beyond the explicit template.

Practice in the Live Editor

Open the HTML editor, change grid-auto-rows values, and watch how implicit row heights change.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful