CSS grid-area Property

❮ Previous Reference Next ❯

Example

.item1 {
  grid-area: 2 / 1 / span 2 / span 3;
}





1
2
3
4
5
6
7

Meaning

The grid-area shorthand property specifies a grid item's size and location within a grid by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area.

Default value:auto / auto / auto / auto
Inherited:No
Animatable:Yes
Version:CSS Grid Layout Module Level 1
JavaScript syntax:
object.style.gridArea="grid-row-start / grid-column-start / grid-row-end / grid-column-end | itemname|initial|inherite|revert|revert-layer|unset";



Standard Syntax

grid-area: grid-row-start / grid-column-start / grid-row-end / grid-column-end | itemname|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
grid-row-start Specifies on which row to start displaying the item.
grid-column-start Specifies on which column to start displaying the item.
grid-row-end Specifies on which row-line to stop displaying the item, or how many rows to span.
grid-column-end Specifies on which column-line to stop displaying the item, or how many columns to span.
itemname Specifies a name for the grid item.
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-area: auto / auto / auto / auto;
}



More Example

Example

.grid-container {
  display: grid;
  grid-template-columns: auto auto auto;
}

.item3 {
  grid-area: 1/2/3/4;
  border: 2px solid red;
}
❮ Previous Reference Next ❯