CSS grid-template-rowsProperty


Example

Specifies the row size (height):

.grid-container { display: grid; grid-template-rows: 100px 300px; }

Try it Yourself »

Browser Support

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

Property
grid-template-rows 57 16 52 10 44

Property definition and usage instructions

The grid-template-rows property is used to set the number and height of rows in a grid layout.

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

Default Value: auto
Inherited: no
animation: Supported.Read Aboutanimatable Try it Yourself
version: CSS Grid Layout Module Level 1
JavaScript Syntax: object.style.gridTemplateRows="50px 200px" Try it Yourself


Syntax

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

Value Description
none Default value; the row size is not specified.
auto The size of a row is determined by the size of the container and the size of the grid items' content in the row.
max-content Each row's size is set to the size of the largest grid item in that row.
min-content Each row's size is set to the size of the smallest grid item in that row.
length Length values, can be numeric values in px or percentages %. 0 is the default value. Learn more.Length Units。
initial Sets this property to its default value.Read about initial
inherit Inherits this property from the parent element. Read about inherit

Related Articles

CSS Tutorial:CSS Grid Layout

CSS Reference Manual:grid-columns Property

CSS Reference Manual:grid-templateProperty

other extensions