Skip to content
Tutorials Center
My learning

Topics

CSS Reference ยท Grid

The grid-row-end property

Reference for the CSS grid-row-end property: set the horizontal grid line where a grid item stops, with numbers, names and span, plus a live example.

The grid-row-end property sets the horizontal grid line where a grid item ends. The end line is exclusive: an item with grid-row-start: 1 and grid-row-end: 3 covers rows 1 and 2. Use it with grid-row-start, or write both in the grid-row shorthand.

CSS
.panel {
  grid-row-start: 1;
  grid-row-end: span 2;
}

Try it

Ending a row span

Syntax

CSS
grid-row-end: auto | <custom-ident> | [ <integer> && <custom-ident>? ] | [ span && [ <integer> || <custom-ident> ] ];
  • Initial value: auto
  • Applies to: grid items and absolutely positioned boxes whose containing block is a grid container
  • Inherited: no
  • Animatable: no
  • Computed value: as specified

Values

Value Description
auto Ends one row after the start (default span of 1).
<integer> End on that line. -1 is the bottom line of the explicit grid.
<custom-ident> End on the first line with that name; an area name maps to name-end.
<integer> <custom-ident> End on the nth line with that name.
span <integer> Cover that many rows from the start line.

Usage notes

  • Count lines, not rows. To cover three rows from line 1 the end line is 4.
  • -1 stops at the explicit grid. Items in implicit rows aren't included, so grid-row: 1 / -1 is not "all rows" when implicit ones exist.
  • Swapped or equal lines are corrected by the browser: start and end are swapped, or the item spans one row.
  • Row heights. In a grid with auto-sized rows a spanning item shares its height across the rows it covers, which can make the layout shift when content changes.
  • Prefer span for reusable components, as it doesn't depend on which row the item lands in.

Browser support

Supported in all current browsers.