CSS grid-auto-rows Property
Example
Set a default size for the rows in a grid:
.grid-container {
display: grid;
grid-auto-rows: 150px;
}
Try it Yourself »
Definition and Usage
The grid-auto-rows
property sets a size for the rows in a grid container.
This property affects only rows with the size not set.
Default value: | auto |
---|---|
Inherited: | no |
Animatable: | yes. Read about animatable Try it |
Version: | CSS Grid Layout Module Level 1 |
JavaScript syntax: | object.style.gridAutoRows="60px" Try it |
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
grid-auto-rows | 57 | 16 | 52 | 10 | 44 |
CSS Syntax
grid-auto-rows: auto|fit-content()|max-content|min-content|minmax()|length|%|initial|inherit;
Property Values
Value | Description | Demo |
---|---|---|
auto | Default value. The size of the rows is determined by the size of the largest item in the row | Demo ❯ |
fit-content() | Sets the size of the rows in length or %, and works like the rows will use the available space, but it will never expand the max-content size | |
max-content | Sets the size of each row to depend on the largest item in the row | Demo ❯ |
min-content | Sets the size of each row to depend on the smallest item in the row | Demo ❯ |
minmax() | Sets a size range greater than or equal to min and less than or equal to max | |
length | Sets the size of the rows, by using a legal length value. Read about length units | Demo ❯ |
% | Sets the size of the rows, by using a percent value | |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit | |
Related Pages
CSS Tutorial: CSS Grid Layout
CSS Reference: The grid-auto-columns property