CSS grid-row Property

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

Definition and Usage

The grid-row property is the shorthand for grid-row-start and grid-row-end. It sets where a grid item begins and ends vertically by choosing row lines, a span, or auto.

Use it on a grid item inside a display: grid container with grid-template-rows. For columns, use grid-column. For all four edges (or a named area), use grid-area.

Baseline · Widely available.

Not deprecated and not experimental. Row line 0 is invalid — lines start at 1 (or negative from the end).

CSS Syntax

syntax.css
grid-row: <start-line> / <end-line> | span <n> | auto | initial | inherit;

One value sets start (end stays auto). Two values separated by / set start then end. Initial value is auto / auto.

Property Values

ValueDescriptionTry it
<start> / <end>Start and end row lines (e.g. 1 / 3)Try it
span <n>Span n rows from the start edgeTry it
Negative endCount from the end; e.g. 2 / -1Try it
autoAuto-placement / default span of 1Try it
initialResets to auto / autoTry it
inheritUses the parent’s grid-rowTry it

How to Use grid-row

Create rows, then place one item with start and end lines.

  1. Build a grid with display: grid and grid-template-rows.
  2. Remember lines: three rows create lines 1, 2, 3, and 4.
  3. Set grid-row on the item (e.g. 1 / 3 or span 2).
  4. Optionally set grid-column, or use grid-area for both axes.
PieceRequired?Role
Grid containerYesdisplay: grid with row tracks
Grid itemYesThe child you are placing
Start / endYesLine numbers, span, name, or auto
Column placementOptionalUse grid-column if needed

Live Preview

Three equal rows. Change only grid-row on the highlighted item.

Lines: 1 | row | 2 | row | 3 | row | 4. -1 is the end edge of the explicit grid.

Grid

grid-row: 1 / 3

CSS Examples

Each snippet focuses on grid-row. Use Try It Yourself for a live editor.

Example 1 — 1 / 3

Stretch the item from row line 1 to row line 3 (two rows).

CSS
<style>
  .grid {
    display: grid;
    grid-template-rows: 1fr 1fr 1fr;
  }
  .item {
    grid-row: 1 / 3;
  }
</style>

<div class="grid">
  <div class="item">Tall</div>
  <div>A</div><div>B</div>
</div>
Try It Yourself

How It Works

  1. Create three rows. That makes lines 1–4 down the grid.
  2. Set both edges. 1 / 3 means start at line 1, end at line 3.
  3. Span two tracks. The item covers the first two row tracks.
  4. Shorthand. Same as grid-row-start: 1 and grid-row-end: 3.

Example 2 — span 2

Let the item cover two rows without naming both lines.

CSS
<style>
  .grid {
    display: grid;
    grid-template-rows: 1fr 1fr 1fr;
  }
  .item {
    grid-row: span 2;
  }
</style>

<div class="grid">
  <div class="item">Tall</div>
  <div>A</div>
</div>
Try It Yourself

How It Works

  1. Use span syntax. span 2 means the item is two row lines tall.
  2. Auto placement. The grid usually puts it in the first free cells that fit.
  3. Same idea with an end. You can also write 1 / span 2 to pin the start.
  4. Columns differ. For horizontal span, use grid-column instead.

Example 3 — 2 / -1

Start at row line 2 and stretch to the end of the explicit grid.

CSS
<style>
  .grid {
    display: grid;
    grid-template-rows: 1fr 1fr 1fr;
  }
  .item {
    grid-row: 2 / -1;
  }
</style>

<div class="grid">
  <div>A</div>
  <div class="item">End</div>
</div>
Try It Yourself

How It Works

  1. Pin the start. Line 2 is the top of the second row track.
  2. Use -1 for the end. Negative lines count from the end of the explicit grid.
  3. Useful pattern. Stay correct even if you later add more rows.
  4. Remember: 0 is invalid; use 1 or a negative integer.

Edge Cases & Pitfalls

If placement looks wrong, check these first.

lines

Lines ≠ rows

Three rows create four lines. grid-row: 1 / 3 ends at the third line, covering two tracks — not “row index 3”.

zero

Line 0 is invalid

Use 1 or higher, or a negative integer from the end. Zero is discarded.

shorthand

grid-area can overwrite row

Writing grid-area after grid-row can reset all four edges. Put the more specific rule last, or include the row in grid-area.

container

Only works on grid items

The parent must be a grid (or the item absolutely positioned against a grid). On a block parent, the property has no effect.

overlap

Items can share cells

Explicit placement can stack items in the same area. That is allowed — use it on purpose, or adjust lines to avoid surprise overlaps.

Browser Support

grid-row is a browser CSS property for Grid item placement. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

grid-row

Chrome 57+, Edge 16+, Firefox 52+, Safari 10.1+. Internet Explorer needs older -ms- Grid syntax.

97% Modern browser 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 No (use -ms- Grid)
Not supported
grid-row Widely supported

Bottom line: Safe for modern Grid layouts. Prefer standard Grid over legacy -ms- prefixes except when you must support Internet Explorer. It is not a runtime API.

Key Takeaways

  • Role: shorthand for grid-row-start and grid-row-end.
  • Lines vs tracks: n rows → n+1 lines; 1 / 3 spans two rows.
  • Slash syntax: start before /, end after.
  • Initial value: auto / auto. Not inherited.

One line: grid-row: 1 / 3; parks the item from row line 1 to line 3.

Frequently Asked Questions

It is the shorthand for grid-row-start and grid-row-end. It sets where a grid item begins and ends vertically along the row axis.
Both longhands default to auto. The item is auto-placed and usually spans one row.
The item starts at row line 1 and ends at row line 3, so it covers two row tracks.
It spans two rows. With auto placement, the item usually fills the next free cells that fit that height.
grid-row sets only the row edges. grid-area can set all four edges, or assign a named grid area.
It is Baseline Widely available. Chrome 57+, Edge 16+, Firefox 52+, Safari 10.1+, and modern Opera support it. Internet Explorer needs older -ms- Grid. It is a browser CSS property, not a Node.js feature.

Next: grid-row-end

Set only the ending row line of a grid item.

grid-row-end 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