CSS grid-row-end Property

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

What You’ll Learn

The grid-row-end property sets where a grid item stops on the row axis, controlling how many rows it spans vertically.

01

End line

Stop row.

02

auto

Default end.

03

span 2

Row count.

04

Line #

Exact stop.

05

With start

Pair lines.

06

Grid item

Child element.

Introduction

The grid-row-end property in CSS is used in the Grid Layout to define the ending position of a grid item within the grid’s rows. This property allows you to span grid items over multiple rows, helping you create more complex and flexible layouts.

Definition and Usage

Apply grid-row-end on a child of a grid container. Use it alone with span n to stretch an item across multiple rows from its auto-placed start. Pair it with grid-row-start when you need both the starting and ending row lines defined separately.

💡
Beginner Tip

grid-row-end: span 2 means the item covers two row tracks. You can also use a line number like grid-row-end: 3 to stop at row line 3.

📝 Syntax

The syntax for the grid-row-end property is straightforward. You can specify the row line where the grid item should end or the number of rows it should span:

syntax.css
element {
  grid-row-end: value;
}

Basic Example

grid-row-end-basic.css
.item1 {
  grid-row-end: span 2;
}

With grid-row-start

grid-row-end-with-start.css
.featured {
  grid-row-start: 2;
  grid-row-end: 4;
}
grid-row-end: span 2; grid-row-end: 3; grid-row-end: -1;

Default Value

The default value of the grid-row-end property is auto, which means the grid item will end at the next available grid line by default.

Syntax Rules

  • Applies to grid items (children of a grid container), not the container itself.
  • Accepts line numbers, span n, named lines, and auto.
  • Works with grid-row-start; together they form the grid-row shorthand.
  • The property is not inherited.
  • Negative line numbers count from the bottom of the grid.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toGrid items
InheritedNo
ControlsEnding row line
Shorthand partnergrid-row-start

💎 Property Values

ValueDescription
autoThe grid item will span one row by default
line numberThe grid item’s ending position is defined by the grid line number, e.g., grid-row-end: 3
span valueThe grid item will span the specified number of rows, e.g., grid-row-end: span 2
nameThe item will end at the named grid line

👀 Live Preview

Item 1 spans two rows with grid-row-end: span 2 (highlighted):

1
2
3
4
5
6

Examples Gallery

Span rows with span, set an exact ending line, combine start and end, and stretch to the bottom row.

🔢 Row End Placement

Start with the reference example — an item spanning two rows.

Example 1 — span 2 Rows

Make an item span two rows using the span keyword on the end property.

grid-row-end-span.css
.item1 {
  grid-row-end: span 2;
}
Try It Yourself

How It Works

From its auto-placed starting row, Item 1 extends across two row tracks because grid-row-end: span 2 sets the ending position two rows later.

Example 2 — End at Row Line 3

Stop an item at a specific row line number.

grid-row-end-line.css
.tall {
  grid-row-start: 1;
  grid-row-end: 3;
}
Try It Yourself

How It Works

Starting at row line 1 and ending at row line 3 covers two row tracks (rows 1 and 2).

📈 Precise Placement

Combine start and end lines for exact row boundaries.

Example 3 — Featured Block from Row 2 to 4

Place a featured section between specific row lines.

grid-row-end-featured.css
.featured {
  grid-row-start: 2;
  grid-row-end: 4;
}
Try It Yourself

How It Works

The featured block starts at row line 2 and ends at row line 4, spanning rows 2 and 3.

Example 4 — End at the Last Row Line

Use a negative line number to stretch an item to the bottom of the grid.

grid-row-end-negative.css
.sidebar {
  grid-row-start: 1;
  grid-row-end: -1;
}
Try It Yourself

How It Works

-1 refers to the last row line. Combined with grid-row-start: 1, the sidebar fills from top to bottom.

♿ Accessibility

  • Keep DOM order meaningful when row spanning changes visual reading flow.
  • Do not rely on row position alone to convey meaning; use headings and labels.
  • Test keyboard tab order when tall items reorder the visual layout.
  • Use semantic HTML such as <nav> and <main> alongside grid placement.
  • Verify content remains readable when items span many rows on small screens.

🧠 How grid-row-end Works

1

Item gets a start position

Auto-placement or grid-row-start sets where the item begins.

Start
2

grid-row-end is set

You define the ending line or span with span n or a line number.

End
3

Browser spans rows

The item stretches vertically from start to end across row tracks.

Span
=

Controlled row height

The item covers exactly the rows defined by its ending line.

🖥 Browser Compatibility

The grid-row-end property is widely supported in modern browsers, including recent versions of Chrome, Firefox, Safari, Edge, and Opera.

Baseline · Modern browsers

grid-row-end everywhere

Row end placement 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-row-end property 97% supported

Bottom line: Safe for modern projects. Pair with grid-row-start or use grid-row shorthand.

🎉 Conclusion

The grid-row-end property is a powerful feature of CSS Grid Layout that allows you to control the ending position of grid items within rows. By using this property, you can create more flexible and dynamic layouts.

Experiment with different values to see how you can leverage the grid-row-end property to enhance your web designs. Start with span, then pair with grid-row-start for precise boundaries.

💡 Best Practices

✅ Do

  • Use span n for flexible row counts
  • Pair with grid-row-start for exact placement
  • Use negative lines to reach the grid bottom
  • Prefer grid-row shorthand when setting both sides
  • Test responsive behavior at smaller widths

❌ Don’t

  • Apply on grid containers instead of items
  • Confuse row lines with row count
  • Forget that line numbering starts at 1
  • Break reading order without testing a11y
  • Mix conflicting start and end values carelessly

Key Takeaways

Knowledge Unlocked

Five things to remember about grid-row-end

Use these points when setting the ending row line.

5
Core concepts
auto 02

Default auto

One row.

Default
span 03

span 2

Two rows.

Syntax
3 04

Line number

Exact stop.

Pattern
start 05

With start

Pair lines.

Workflow

❓ Frequently Asked Questions

grid-row-end sets the row line where a grid item stops, controlling how far the item extends vertically across rows.
The default is auto, which means the item spans one row and ends at the next row line from its starting position.
grid-row-end sets only the ending row line. grid-row is shorthand for both grid-row-start and grid-row-end.
The item spans two rows from its starting row line, ending two tracks later.
Yes. Negative numbers count from the bottom of the grid. For example, grid-row-end: -1 ends at the last row line.

Practice in the Live Editor

Open the HTML editor, change grid-row-end values, and watch items span different row heights.

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