CSS Reference ยท Grid
The grid-column-start property
Reference for the CSS grid-column-start property: choose the grid line where an item begins, using line numbers, names or span, with examples and notes.
The grid-column-start property tells a grid item which vertical grid line its box begins on. Together with grid-column-end it decides which columns the item covers. Lines are numbered from 1 at the start edge of the explicit grid, and negative numbers count back from the end.
Most of the time you will set both ends at once with the grid-column shorthand, but the longhand is useful when you only want to override one side, for example in a media query.
.card { grid-column-start: 2; }
Try it
Syntax
grid-column-start: auto; grid-column-start: <integer>; grid-column-start: <custom-ident>; grid-column-start: <integer> <custom-ident>; grid-column-start: span <integer>; grid-column-start: span <custom-ident>; grid-column-start: span <integer> <custom-ident>;
- Initial value:
auto - Applies to: grid items and absolutely positioned boxes whose containing block is a grid container
- Inherited: no
- Animatable: no
- Computed value: as specified
Values
| Value | Description |
|---|---|
auto |
No preference. The item is placed by the auto-placement algorithm and, if the end line is not set either, spans one column. |
<integer> |
Start on that line number. 1 is the first line, -1 is the last line of the explicit grid. 0 is invalid. |
<custom-ident> |
Start on the first line with that name, for example a line named [content-start]. A name matching an area (header gives header-start) also works. |
<integer> <custom-ident> |
Start on the nth line with that name. 2 sidebar means the second line called sidebar. |
span <integer> |
Start so that the item covers that many tracks, counted towards the end line. The span is relative to grid-column-end. |
span <custom-ident> |
Span until the next line with that name. |
Usage notes
- Lines, not columns. A grid with 4 columns has 5 lines.
grid-column-start: 5is the right edge of the last column, which is rarely what you want for a start line. - Negative numbers count from the end of the explicit grid only. If the item creates implicit columns,
-1does not move with them. spanas the start is legal, but when both start and end arespanthe end is ignored and the item spans one column. Prefergrid-column-start: 2; grid-column-end: span 2.- Overlap is allowed. Items placed on the same cells simply stack; control the order with
z-index. - If start is after end the browser swaps them. If they are equal, the end is treated as
start + 1. - Source order stays the same. Moving an item visually does not change keyboard focus order or reading order, so do not rearrange content in ways that confuse people who navigate without a mouse.
- Auto-placed siblings flow around explicitly placed items, unless
grid-auto-flowisdense, which backfills earlier holes.
Browser support
Supported in all current browsers; the grid-column-start name works everywhere CSS Grid does.
Related
grid-column-end- the end linegrid-row-start- the vertical counterpartgrid-auto-flow- how unplaced items are positioned- Lesson: Placing Grid Items