CSS grid-row-end Property

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

Definition and Usage

The grid-row-end property sets where a grid item stops vertically. You pick a row line number, a span, a named line, or auto.

It works on grid items inside a display: grid container. Pair it with grid-row-start, or use the grid-row shorthand for both edges.

Baseline · Widely available.

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

CSS Syntax

syntax.css
grid-row-end: auto | <integer> | span <integer> | <custom-ident> | initial | inherit;

The initial value is auto. Integers may be negative to count from the end of the explicit grid.

Property Values

ValueDescriptionTry it
<integer>End at that row line (e.g. 3)Try it
span <integer>End edge is n lines after the start edgeTry it
Negative lineCount from the end; -1 is the last lineTry it
autoAuto-placement / default span of 1. Initial valueTry it
initialResets to autoTry it
inheritUses the parent’s grid-row-endTry it

How to Use grid-row-end

Create rows, then tell one item which line to end on.

  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-end on the item (a line number or span).
  4. Optionally set grid-row-start, or use grid-row shorthand.
PieceRequired?Role
Grid containerYesdisplay: grid with row tracks
Grid itemYesThe child you are placing
End valueYesLine number, span, name, or auto
Start lineOptionalControls where the item begins

Live Preview

Three equal rows. The item starts at line 1; change only grid-row-end.

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

Grid

grid-row-end: 3

CSS Examples

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

Example 1 — End at Line 3

Start at line 1 and stop at row line 3 (two rows tall).

CSS
<style>
  .grid {
    display: grid;
    grid-template-rows: 1fr 1fr 1fr;
  }
  .item {
    grid-row-start: 1;
    grid-row-end: 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. Pin the start. grid-row-start: 1 places the top edge on line 1.
  3. Set the end. grid-row-end: 3 stops at line 3 — two tracks tall.
  4. Shorthand option. grid-row: 1 / 3 does both in one rule.

Example 2 — span 2

Grow two rows down from the start edge.

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

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

How It Works

  1. Fix the start. Line 1 anchors the top of the item.
  2. Use span on the end. span 2 places the end two lines after the start.
  3. Result. The item covers two row tracks.
  4. Same idea alone. grid-row-end: span 2 without a start often auto-places a two-row item.

Example 3 — End at -1

Stretch from row line 1 to the last line of the explicit grid.

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

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

How It Works

  1. Count from the end. -1 is the last line of the explicit grid.
  2. Fill the height. Start at 1 and end at -1 covers every defined row.
  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-end: 3 stops at the third line, not “row index 3” in every mental model.

zero

Line 0 is invalid

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

shorthand

grid-row can overwrite end

Writing grid-row after grid-row-end replaces both edges. Put the longhand last, or include the end in the shorthand.

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-end is a browser CSS property for Grid item placement. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

grid-row-end

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-end 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: set the ending row line (or span) of a grid item.
  • Lines vs tracks: n rows → n+1 lines; -1 is the last line.
  • Shorthand: grid-row sets start and end together.
  • Initial value: auto. Not inherited.

One line: grid-row-end: 3; (with a start) parks the item’s bottom edge on row line 3.

Frequently Asked Questions

It sets where a grid item ends vertically by choosing a row line, a span, or auto-placement.
The initial value is auto. The item usually spans one row from its start line.
The item’s bottom edge sits on row line 3 — the bottom edge of the second row track in a top-to-bottom grid.
grid-row-end: span 2 makes the end edge two row lines after the start edge, so the item spans two rows when the start is fixed or auto.
grid-row-end sets only the end. grid-row is the shorthand for both grid-row-start and grid-row-end.
It is Baseline Widely available. Chrome 57+, Edge 16+, Firefox 52+, Safari 10.1+, and modern Opera support it. Internet Explorer needs the older -ms- prefixed Grid. It is a browser CSS property, not a Node.js feature.

Next: grid-row-gap

Review the legacy alias for vertical gutters between rows.

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