CSS grid-template-rows property
Example
Specify the row size (height):
.grid-container
{
display:
grid
;
grid-template-rows:
100
px
300
px
;
}
Try it »
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| grid-template-rows | 57 | 16 | 52 | 10 | 44 |
Property definition and usage
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 |
| Animatable: | support. Read about animatable Try it |
| Version: | CSS Grid Layout Module Level 1 |
| JavaScript syntax: | object.style.gridTemplateRows="50px 200px" Try it |
Syntax
grid-template-rows: none|auto|max-content|min-content|length|initial|inherit;
| Value | Description |
|---|---|
| none | Default value; no row size is specified. |
| * auto * | The row size is determined by the size of the container and the size of the content of the grid items in the row. |
| max-content | Each row is sized to the largest grid item in that row. |
| * min-content* | Each row is sized to the smallest grid item in that row. |
| * length* | A length value, which can be a number in px or a percentage %. 0 is the default value. Learn moreLength 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-template property