CSS grid-column property
Example
Set "item1" to start at column 1 and end before column 5:
.item1
{
grid-column:
1
/
5
;
}
Try it »
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| grid-column | 57 | 16 | 52 | 10 | 44 |
Property definition and usage
The grid-column property defines the start and end positions of a grid item's column.
Note: grid-column is the shorthand for the grid-column-start and grid-column-end properties.
We can set grid items by referring to line numbers, or use the keyword "span" to define how many columns the item will span.
| Default value: | auto / auto |
|---|---|
| Inherited: | no |
| Animatable: | support. Read about animatable Try it |
| Version: | CSS Grid Layout Module Level 1 |
| JavaScript syntax: | object.style.gridColumn="2 / span 2" Try it |
Syntax
grid-column: grid-column-start / grid-column-end;
| Value | Description |
|---|---|
| grid-column-start | Specifies which column the grid item starts displaying at. |
| grid-column-end | Specifies which column the grid item ends at, or how many columns it spans. |
Example
The following example sets "item1" to span 3 columns:
.item1
{
grid-column:
1
/
span
3
;
}
Try it »
The following example sets "item2" to span 3 columns:
Example
.item2
{
grid-column:
2
/
span
3
;
}
Try it »
Related Articles
CSS Tutorial: CSS Grid Layout