CSS grid-row-gap Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The grid-row-gap property sets the vertical gutter between rows in a CSS grid container. Negative values are invalid. Gaps appear only between rows, not on the outer edges.

Prefer the modern name row-gap. Use gap when you want row and column gutters together, and grid-column-gap / column-gap for horizontal spacing.

Legacy alias Prefer row-gap

grid-row-gap was replaced by row-gap and remains a working alias. Use row-gap in new CSS.

CSS Syntax

syntax.css
grid-row-gap: normal | <length-percentage> | initial | inherit;

Same values as row-gap. Example: grid-row-gap: 1rem;

Property Values

ValueDescriptionTry it
normalDefault. In grid, this is 0 (no row gutter)Try it
<length>Fixed gap such as 20px or 1remTry it
<percentage>Relative to the grid container’s block size when definiteTry it
initialResets to normalTry it
inheritTakes the parent value (not inherited by default)Try it

How to Use grid-row-gap

Make a grid, then set the space between its rows.

  1. Set display: grid on the container.
  2. Define columns/rows with grid-template-columns (and rows if needed).
  3. Add grid-row-gap (or better, row-gap) with a non-negative length or percentage.
  4. Use gap if you also need column spacing in one declaration.
PropertySets
grid-row-gap / row-gapSpace between rows only
grid-column-gap / column-gapSpace between columns only
gapRow and column gutters together

Live Preview

The 2×2 grid stays fixed. Change only grid-row-gap and watch the vertical gutters.

Only space between rows changes. Column gutters stay at zero here.

Grid rows
1
2
3
4

grid-row-gap: 16px

CSS Examples

Each snippet focuses on grid-row-gap. A minimal grid scaffold is included so the gutter is visible. Use Try It Yourself for a live editor.

Example 1 — Pixel Row Gap

A fixed 20px gutter between grid rows.

CSS
<style>
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-row-gap: 20px;
  }
</style>

<div class="grid">
  <div>1</div><div>2</div>
  <div>3</div><div>4</div>
</div>
Try It Yourself

How It Works

  1. Create a grid. display: grid with two columns makes two rows of items.
  2. Set the row gutter. grid-row-gap: 20px inserts 20px between row 1 and row 2.
  3. Columns stay tight. No column gap is set, so horizontal neighbors touch.
  4. Same as row-gap. Prefer row-gap: 20px in new stylesheets.

Example 2 — rem Row Gap

Scale the gutter with the root font size.

CSS
<style>
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-row-gap: 1.5rem;
  }
</style>

<div class="grid">
  <div>1</div><div>2</div>
  <div>3</div><div>4</div>
</div>
Try It Yourself

How It Works

  1. Same grid scaffold. Two columns, four cells.
  2. Use rem. 1.5rem ties the gutter to root font size.
  3. Still between rows only. Outer edges of the grid get no gap from this property.
  4. Legacy name. Writing row-gap: 1.5rem is the modern equivalent.

Example 3 — No Row Gap

normal (or 0) removes the vertical gutter in grid.

CSS
<style>
  .grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-row-gap: normal;
  }
</style>

<div class="grid">
  <div>1</div><div>2</div>
  <div>3</div><div>4</div>
</div>
Try It Yourself

How It Works

  1. Default gutters. In grid, normal means no extra row space.
  2. Rows sit flush. Item 1/2 touch item 3/4 vertically.
  3. Useful reset. Clears a larger gap set earlier in the cascade.
  4. Same with 0. Explicit zero length is another way to remove the gutter.

Edge Cases & Pitfalls

Gaps are gutters between tracks — not padding around the grid.

alias

Prefer row-gap for new code

grid-row-gap still works, but row-gap is the standard name and applies beyond grid alone.

edges

No outer padding

Row gap never adds space above the first row or below the last. Use padding/margin on the container for that.

negative

Negative values are invalid

A negative gap is dropped. Stick to 0 or positive lengths/percentages.

one row

One row = nothing to see

With a single row of items, row gap has no adjacent tracks to separate.

shorthand

gap can override both

A later gap declaration sets row and column gutters together and can replace a lone grid-row-gap.

Browser Support

grid-row-gap is a browser style property (legacy alias of row-gap). Node.js, Deno, and Bun do not apply it.

✓ Legacy alias · Widely available

grid-row-gap

Grid alias: Chrome 57+, Firefox 52+, Safari 10.1+, Edge 16+. Modern engines also accept row-gap (prefer that name).

96% grid support
Google Chrome 57+
Full support
Mozilla Firefox 52+
Full support
Apple Safari 10.1+
Full support
Microsoft Edge 16+
Full support
Opera 44+
Full support
Samsung Internet 6+
Full support
Internet Explorer All
Not supported
grid-row-gap Supported wherever CSS Grid gaps work

Bottom line: Safe in modern browsers as an alias. Teach and write row-gap going forward; keep grid-row-gap for older grid-only stylesheets.

Key Takeaways

  • Role: vertical gutter between CSS grid rows.
  • Alias: same as row-gap — prefer that name in new CSS.
  • Default: normal → 0 in grid.
  • Edges: gaps never pad the outside of the grid.

One line: grid-row-gap is the legacy name for the vertical space between grid rows — use row-gap today.

Frequently Asked Questions

It sets the vertical gutter between rows in a CSS grid. Today it is an alias for row-gap and behaves the same.
Prefer row-gap for new code. It is the standard name and also works in flex and multi-column layouts. Keep grid-row-gap only when maintaining older grid CSS.
normal, which computes to 0 in grid layout (no extra space between rows).
No. Gaps sit only between rows, not above the first row or below the last row.
grid-row-gap / row-gap set only the row gutter. gap is shorthand for row and column gutters together.
As a grid alias: Chrome 57+, Firefox 52+, Safari 10.1+, Edge 16+. It is a browser style property, not a Node.js feature.

Next: grid-row-start

Place an item by its starting row line.

grid-row-start tutorial →

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.

8 people found this page helpful