CSS grid-template-areas Property
Example
.grid-container {
display: grid;
grid-template-areas:
"header header header"
"nav nav nav"
"column1 column2 column3"
"footer footer footer";
}
.item1 { grid-area: header; }
.item2 { grid-area: nav; }
.item3 { grid-area: column1; }
.item4 { grid-area: column2; }
.item5 { grid-area: column3; }
.item6 { grid-area: footer; }
Meaning
The grid-template-areas property specifies named grid areas, establishing the cells in the grid and assigning them names.
The syntax of the grid-template-areas property also provides a visualization of the structure of the grid, making the overall layout of the grid container easier to understand.
Default value: | none |
Inherited: | No |
Animatable: | Yes |
Version: | CSS Grid Layout Module Level 1 |
JavaScript syntax: |
|
Standard Syntax
grid-template-areas: none|itemnames|initial|inherite|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
none | This is default value. No named grid areas. |
itemnames | Specifies a sequence how each columns and row should display. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
grid-template-areas: none;
}