CSS grid-template-rows Property


Example

Specify the row-size (height):

.grid-container {
  display: grid;
  grid-template-rows: 100px 300px;
}
Try it Yourself »

Definition and Usage

The grid-template-rows property specifies the number (and the heights) of the rows in a grid layout.

The values are a space-separated list, where each value specifies the height of the respective row.

Show demo ❯

Default value: none
Inherited: no
Animatable: yes. Read about animatable Try it
Version: CSS Grid Layout Module Level 1
JavaScript syntax: object.style.gridTemplateRows="50px 200px" Try it

Browser Support

The numbers in the table specify the first browser version that fully supports the property.

Property
grid-template-rows 57 16 52 10 44


CSS Syntax

grid-template-rows: none|auto|max-content|min-content|length|initial|inherit;

Property Values

Value Description Demo
none No size is set. Rows are created if needed Demo ❯
auto The size of the rows is determined by the size of the container, and on the size of the content of the items in the row Demo ❯
max-content Sets the size of each row to depend on the largest item in the row
min-content Sets the size of each row to depend on the smallest item in the row
length Sets the size of the rows, by using a legal length value. Read about length units Demo ❯

Related Pages

CSS Tutorial: CSS Grid Layout

CSS Reference: The grid-columns property

CSS Reference: The grid-template property


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.