CSS grid-row-end Property

If this site has been useful, we’d love your support! Running this site takes time and resources, and every small contribution helps us keep creating valuable content. Consider buying us a coffee to keep things going strong!

Description

The grid-row-end property determines how many lines an element will occupy, or on which line the element ends in the grid layout. In order to determine how many lines an element will occupy, or on which line the element starts in the grid layout, you can use the grid-row-start property.

Initial value
auto
Applies to
Grid items and absolutely-positioned boxes whose containing block is a grid container
Inherited
No
Computed value
As specified
Animatable
Yes
JavaScript syntax
object.style.gridRowEnd

Interactive Demo

One
Two
Three

Syntax

grid-row-end: auto | line | line-name | span line

Values

  • autoA keyword indicating that the property does not affect the placement of the element in the grid layout (automatic placement, automatic range, or default range of 1). This is the default value.
  • lineAn integer that corresponds to the initial face of the element in the grid layout (counting the faces is left to right from the left edge of the element, a schematic display at the top of the page). If a negative integer is specified, then the count is in the reverse order, starting from the end edge of the explicit layout grid. A value of 0 is not valid.
  • line-nameA string value that refers to a named column in a grid layout. The element is located from the initial face of the specified element.
  • span lineThe span keyword with an integer that determines how many columns the grid element will span. If an integer is omitted, the default value is 1. A negative value or a value of 0 is not valid.

Example

<div class="grid-container">
<div class="item-a">A</div>
<div>B</div>
<div>C</div>
<div>D</div>
</div>
<div class="grid-container2">
<div>A</div>
<div class="item-b">B</div>
<div>C</div>
<div>D</div>
</div>
.grid-container,
.grid-container2 {
   display: grid; 
   margin-top: 5px;
   padding: 10px;
   background: rgb(0,150,208); 
   grid-template-rows: [line1] auto  [line2] auto  [line3] auto  [line4] auto;
}
.grid-container > div,
.grid-container2 > div { 
   background: rgb(241,101,41);
   border: 1px solid #000; 
   text-align: center;
} 
.item-a {
   grid-row-end: 3;
   background: red !important;
}
.item-b {
   grid-row-end: line4;
   background: yellow !important; 
}

Browser Support

The following table will show you the current browser support for the CSS grid-row-end property.

Desktop
Edge Chrome Firefox Opera Safari
1657524410.1
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
57524310.3657

Last updated by CSSPortal on: 2nd January 2024