CSS grid-column-start Property
The CSS grid-column-start property specifies the starting grid line of a grid item along the column axis.
It works with grid-column-end to determine which columns an item occupies. You can use numbered grid lines, named grid lines, or the span keyword to control placement. When the starting position is automatic, CSS Grid determines it using the grid placement algorithm.
grid-column-start Syntax
The grid-column-start property accepts a single grid line position, a span, or the auto keyword.
Basic Syntax
selector {
grid-column-start: auto;
}
Numbered Grid Line
.item {
grid-column-start: 2;
}
Negative Grid Line
.item {
grid-column-start: -2;
}
Named Grid Line
.item {
grid-column-start: content-start;
}
Numbered Named Line
.item {
grid-column-start: 2 col;
}
Span Multiple Columns
.item {
grid-column-start: span 2;
}
Named Span
.item {
grid-column-start: span col;
}
Automatic Placement
.item {
grid-column-start: auto;
}
CSS-Wide Keywords
.item {
grid-column-start: initial;
}
.item {
grid-column-start: inherit;
}
.item {
grid-column-start: unset;
}
.item {
grid-column-start: revert;
}
.item {
grid-column-start: revert-layer;
}
The value identifies a grid line or describes how the starting boundary should be resolved. It does not accept physical lengths such as 100px or percentages.
Property Values
The grid-column-start property supports the following values.
| Value | Description |
|---|---|
auto |
Allows the grid placement algorithm to determine the starting boundary or use an automatic span. |
<integer> |
References a numbered grid line. Positive numbers count forward from the start, and negative numbers count backward from the end of the explicit grid. |
<custom-ident> |
References a named grid line. |
<integer> <custom-ident> |
References a numbered occurrence of a named grid line. |
span <integer> |
Specifies the number of grid tracks the item spans backward from its ending boundary. |
span <custom-ident> |
Determines the starting boundary by counting matching named lines backward from the ending boundary. |
span <integer> <custom-ident> |
Spans backward to a specified occurrence of a matching named grid line. |
inherit |
Inherits the computed value from the parent element. |
initial |
Resets the property to auto. |
unset |
Resets the non-inherited property to auto. |
revert |
Reverts the property according to the cascade origin rules. |
revert-layer |
Reverts the property according to the cascade layer rules. |
Property Characteristics
| Characteristic | Value |
|---|---|
| Initial value | auto |
| Inherited | No |
| Applies to | Grid items and absolutely positioned boxes whose containing block is a grid container |
| Computed value | As specified |
| Animation type | Discrete |
| Percentages | Not applicable |
| Shorthand properties | grid-column and grid-area |
Grid line numbers cannot be zero. A span count must be a positive integer. The keywords auto and span cannot be used as custom identifiers for grid line names in this property.
How It Works
The grid-column-start property establishes the starting boundary of a grid item along the grid's column axis.
Create a Grid Container
.container {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
}
Set the Starting Line
.item {
grid-column-start: 2;
}
For a normal one-column item with an automatic ending boundary, the item begins at line 2 and occupies the second column.
Set Both Boundaries
.item {
grid-column-start: 2;
grid-column-end: 4;
}
The item starts at line 2 and ends at line 4, occupying two columns.
Equivalent Shorthand
.item {
grid-column: 2 / 4;
}
Leave the Starting Line Automatic
.item {
grid-column-start: auto;
grid-column-end: 4;
}
The browser resolves the starting boundary automatically. For a normal one-column item, the resulting area occupies the track immediately before line 4.
Important Consideration
The starting grid line determines one boundary of the item's grid area. The number and sizes of the columns it occupies depend on the ending boundary and the grid's track definitions.
Grid Line Numbering
Grid lines identify the boundaries between columns. A grid with four explicitly defined columns has five vertical grid lines in a horizontal writing mode.
Four-Column Grid
.container {
display: grid;
grid-template-columns: repeat(4, 1fr);
}
Start at Line One
.item {
grid-column-start: 1;
grid-column-end: 3;
}
The item occupies the first two columns.
Start at Line Two
.item {
grid-column-start: 2;
grid-column-end: 4;
}
The item occupies the second and third columns.
Start at Line Three
.item {
grid-column-start: 3;
grid-column-end: 5;
}
The item occupies the third and fourth columns.
Start at Line Four
.item {
grid-column-start: 4;
grid-column-end: 5;
}
The item occupies the fourth column.
Grid Line Reference
| Start Line | End Line | Columns Occupied |
|---|---|---|
1 |
2 |
First column |
2 |
3 |
Second column |
3 |
4 |
Third column |
4 |
5 |
Fourth column |
2 |
5 |
Second through fourth columns |
Important Consideration
A grid line is a boundary, not a column. For example, grid-column-start: 2 places the starting boundary at the line before the second column in a standard left-to-right grid.
Spanning Columns
The span keyword specifies how many grid tracks an item occupies. When used with grid-column-start, it defines a span relative to the item's ending boundary.
Span Two Columns Backward
.item {
grid-column-start: span 2;
grid-column-end: 5;
}
The item ends at line 5 and spans two columns backward, beginning at line 3.
Span Three Columns Backward
.item {
grid-column-start: span 3;
grid-column-end: 5;
}
The item begins at line 2 and occupies three columns.
Equivalent Numeric Start
.item {
grid-column-start: 2;
grid-column-end: 5;
}
Automatic Ending Boundary
.item {
grid-column-start: span 2;
grid-column-end: auto;
}
The browser automatically positions the item while preserving a two-column span.
Invalid Span Count
.item {
grid-column-start: span 0;
}
A span count of zero is invalid. The count must be a positive integer.
Invalid Spans on Both Boundaries
.item {
grid-column-start: span 2;
grid-column-end: span 3;
}
If both placement longhands specify a span, the grid placement conflict rules cause the ending span to be treated as auto. Avoid this combination because it does not establish two independent span boundaries.
Important Consideration
Use grid-column-start: span ... when the ending boundary is known or when automatic placement should determine the location of an item with a particular column span.
Negative Line Numbers
Negative grid line numbers count backward from the end of the explicit grid.
Last Explicit Grid Line
.item {
grid-column-start: -1;
}
Line -1 identifies the ending boundary of the explicit grid. An item starting there can extend into an implicit column beyond the explicit grid.
Start at the Last Column
.item {
grid-column-start: -2;
grid-column-end: -1;
}
Start Two Columns Before the End
.item {
grid-column-start: -3;
grid-column-end: -1;
}
Start at the First Explicit Line
.item {
grid-column-start: 1;
grid-column-end: -1;
}
This common pattern spans the entire explicit grid.
Negative Line Reference
In a four-column grid, line -1 corresponds to line 5, line -2 corresponds to line 4, and line -3 corresponds to line 3.
Important Consideration
Negative line numbers are relative to the explicit grid boundaries. They do not automatically count from the outermost implicit column.
Named Grid Lines
Named grid lines allow an item's starting boundary to be specified using descriptive identifiers rather than numeric line references.
Define Named Lines
.container {
display: grid;
grid-template-columns:
[sidebar-start] 200px
[content-start] 1fr
[content-end];
}
Start at a Named Line
.main {
grid-column-start: content-start;
grid-column-end: content-end;
}
Position the Sidebar
.sidebar {
grid-column-start: sidebar-start;
grid-column-end: content-start;
}
Repeated Named Lines
.container {
display: grid;
grid-template-columns:
[col] 1fr
[col] 1fr
[col] 1fr
[col];
}
.item {
grid-column-start: col 2;
grid-column-end: col 4;
}
The integer selects a particular occurrence of the named line.
Named Span
.item {
grid-column-start: span 2 col;
grid-column-end: col 4;
}
The starting boundary is determined by counting two matching col lines backward from the ending boundary.
Named Grid Areas
.container {
display: grid;
grid-template-areas: "sidebar main";
grid-template-columns: 200px 1fr;
}
.main {
grid-column-start: main-start;
grid-column-end: main-end;
}
Named grid areas automatically establish corresponding -start and -end line names.
Important Consideration
Named lines make complex layouts easier to maintain. Check the names carefully because references to missing named lines can result in implicit line resolution and unexpected placement.
Automatic Placement
The auto keyword allows the grid placement algorithm to determine the starting boundary of an item.
Default Value
.item {
grid-column-start: auto;
}
Both Boundaries Automatic
.item {
grid-column-start: auto;
grid-column-end: auto;
}
For a normal grid item, the browser places the item in an available grid cell according to the auto-placement algorithm.
Automatic Start with Definite End
.item {
grid-column-start: auto;
grid-column-end: 4;
}
The ending boundary is fixed at line 4. The browser resolves the starting boundary using the item's automatic span.
Automatic Start with Definite Span
.item {
grid-column-start: auto;
grid-column-end: span 2;
}
Row Auto-Placement
.container {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-auto-flow: row;
}
Column Auto-Placement
.container {
display: grid;
grid-template-rows: repeat(2, 100px);
grid-auto-flow: column;
grid-auto-columns: 150px;
}
Dense Placement
.container {
display: grid;
grid-template-columns: repeat(4, 1fr);
grid-auto-flow: row dense;
}
Dense placement can fill earlier available spaces with later items when their spans fit.
Important Consideration
Automatic placement depends on the grid's track definitions, item spans, placement constraints, and grid-auto-flow setting.
Implicit Grid Columns
Specifying a starting grid line outside the explicit grid can cause CSS Grid to create implicit columns.
Define Three Explicit Columns
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-columns: 120px;
}
Start Beyond the Explicit Grid
.item {
grid-column-start: 5;
grid-column-end: 6;
}
The explicit grid ends at line 4. Starting at line 5 requires additional implicit columns.
Size Implicit Columns
.container {
display: grid;
grid-template-columns: repeat(3, 1fr);
grid-auto-columns: minmax(100px, auto);
}
Create Implicit Columns Before the Grid
.item {
grid-column-start: -6;
grid-column-end: -4;
}
In a three-column explicit grid, line -6 lies before the explicit starting boundary, so implicit columns are generated before the grid.
Important Consideration
The grid-column-start property controls placement. The grid-auto-columns property controls the sizes of implicit column tracks.
Start and End Lines
The grid-column-start and grid-column-end properties work together to define an item's column placement.
Set the Starting Boundary
.item {
grid-column-start: 2;
}
Set the Ending Boundary
.item {
grid-column-end: 5;
}
Combine Both Properties
.item {
grid-column-start: 2;
grid-column-end: 5;
}
The item occupies three columns.
Matching Start and End Lines
.item {
grid-column-start: 2;
grid-column-end: 2;
}
When both boundaries resolve to the same line, the ending position is treated as automatic so the item occupies a nonzero span.
Reversed Numeric Boundaries
.item {
grid-column-start: 4;
grid-column-end: 2;
}
When definite grid line positions are reversed, the placement rules normalize the boundaries so the item occupies the tracks between them.
Important Consideration
For predictable layouts, use distinct starting and ending lines in their intended order. The ending line should normally follow the starting line along the column axis.
The grid-column Shorthand
The grid-column shorthand combines the starting and ending column boundaries into a single declaration.
Separate Longhand Properties
.item {
grid-column-start: 2;
grid-column-end: 5;
}
Equivalent Shorthand
.item {
grid-column: 2 / 5;
}
Start Line with Span
.item {
grid-column: 2 / span 3;
}
Span with Ending Line
.item {
grid-column: span 3 / 5;
}
Override Only the Starting Line
.item {
grid-column: 1 / 5;
}
.item.alternate {
grid-column-start: 2;
}
The second rule changes only the starting boundary while preserving the ending line.
Shorthand Reset Behavior
.item {
grid-column-start: 2;
grid-column-end: 5;
grid-column: 3;
}
The final shorthand sets the starting line to 3 and resets the ending line to auto.
Important Consideration
Use grid-column-start when only the starting boundary needs to change. Use grid-column when both boundaries should be declared together.
Responsive Layouts
The grid-column-start property can be adjusted at different viewport widths to change where an item begins.
Single-Column Layout
.page-layout {
display: grid;
grid-template-columns: 1fr;
gap: 16px;
}
.page-layout .main {
grid-column-start: 1;
grid-column-end: -1;
}
Two-Column Layout
@media (min-width: 768px) {
.page-layout {
grid-template-columns: 220px minmax(0, 1fr);
}
.page-layout .sidebar {
grid-column-start: 1;
grid-column-end: 2;
}
.page-layout .main {
grid-column-start: 2;
grid-column-end: -1;
}
}
Featured Card Placement
.card-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.card-grid .featured {
grid-column-start: 1;
grid-column-end: -1;
}
@media (min-width: 900px) {
.card-grid {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
.card-grid .featured {
grid-column-start: 2;
grid-column-end: 4;
}
}
At smaller widths, the featured card spans both columns. At larger widths, it occupies the two middle columns.
Important Consideration
Review starting line references whenever the number of explicit columns changes. A line that exists in a desktop grid may fall outside a smaller grid and create unwanted implicit columns.
Overlapping Grid Items
Grid items can overlap when their assigned row and column areas intersect.
First Item
.item-one {
grid-column-start: 1;
grid-column-end: 3;
grid-row: 1;
}
Second Item
.item-two {
grid-column-start: 2;
grid-column-end: 4;
grid-row: 1;
}
Both items occupy part of the second column in the same row.
Control Stacking Order
.item-two {
z-index: 2;
}
Grid items can use z-index to control stacking order even when their position value is static.
Avoid Accidental Overlap
Check both starting and ending lines, along with row placement, when items unexpectedly appear on top of one another.
Important Consideration
Visual overlap does not change document order. Ensure important content remains readable and accessible.
Writing Direction
Grid column numbering follows the logical inline axis of the grid container.
Left-to-Right Layout
.container {
display: grid;
direction: ltr;
grid-template-columns: repeat(3, 1fr);
}
.item {
grid-column-start: 1;
grid-column-end: 2;
}
In a horizontal left-to-right layout, the first column appears on the left.
Right-to-Left Layout
.container {
display: grid;
direction: rtl;
grid-template-columns: repeat(3, 1fr);
}
.item {
grid-column-start: 1;
grid-column-end: 2;
}
In a horizontal right-to-left layout, the first column appears on the right.
Vertical Writing Mode
.container {
display: grid;
writing-mode: vertical-rl;
grid-template-columns: repeat(3, 1fr);
}
In vertical writing modes, the inline axis runs vertically, so grid columns are oriented differently from those in horizontal writing modes.
Important Consideration
Grid line numbers follow logical directions. Avoid assuming that line 1 always identifies the physical left edge of a grid.
Inheritance
The grid-column-start property is not inherited.
Parent Grid Item
.parent-item {
grid-column-start: 2;
}
Nested Grid Item
.nested-item {
grid-column-start: auto;
}
A nested grid item does not automatically receive the starting line assigned to its parent.
Explicit Inheritance
.nested-item {
grid-column-start: inherit;
}
The inherit keyword copies the computed value from the parent element.
Reset to Initial Value
.item {
grid-column-start: initial;
}
Reset with unset
.item {
grid-column-start: unset;
}
Because the property is not inherited, unset has the same effect as initial.
Important Consideration
Inherited grid line references are interpreted within the receiving item's grid context. They do not automatically refer to the grid lines used by the parent.
grid-column-start Example
This example demonstrates a four-column grid where the first item begins at line 2 and ends at line 5, spanning the final three columns. The remaining items use automatic placement.
HTML Example
<div class="grid-column-start-demo">
<div class="grid-item featured">Featured Item</div>
<div class="grid-item">Item 2</div>
<div class="grid-item">Item 3</div>
<div class="grid-item">Item 4</div>
<div class="grid-item">Item 5</div>
</div>
CSS Example
.grid-column-start-demo {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: 12px;
}
.grid-column-start-demo .grid-item {
padding: 20px 8px;
background-color: #596579;
color: #ffffff;
text-align: center;
font-weight: bold;
border-radius: 4px;
}
.grid-column-start-demo .featured {
grid-column-start: 2;
grid-column-end: 5;
background-color: #2456a6;
}
The featured item uses grid-column-start: 2 and grid-column-end: 5, placing it across columns 2, 3, and 4.
The first column of the first row remains available for automatic placement, so Item 2 can occupy that space. The remaining items continue into the next row.
Changing grid-column-start from 2 to 1 would make the featured item span the entire four-column grid.
Common Mistakes
Common problems with grid-column-start involve incorrect line numbering, invalid spans, and unexpected placement outside the explicit grid.
Forgetting the Grid Container
.item {
grid-column-start: 2;
}
The declaration does not create a grid. Normal grid item placement requires an appropriate grid container.
Using Grid Line Zero
.item {
grid-column-start: 0;
}
Grid line zero is invalid.
Using a Physical Length
.item {
grid-column-start: 200px;
}
The property accepts grid line positions, not pixel lengths.
Using an Invalid Span Count
.item {
grid-column-start: span -2;
}
Span counts must be positive integers.
Confusing a Starting Line with a Column Number
The value identifies a boundary. The item's actual column span also depends on its ending line.
Assuming auto Means Line One
The auto value does not automatically place an item at the first grid line. Placement depends on the grid's auto-placement algorithm.
Assuming Negative Lines Include Implicit Columns
Negative line references count from the explicit grid boundary, not from the last implicit column.
Using Missing Named Lines
References to nonexistent named lines can result in unexpected placement through implicit named-line resolution.
Ignoring Responsive Grid Changes
Fixed line references may extend beyond a smaller grid and create unwanted implicit columns.
Accidentally Resetting the Starting Line
.item {
grid-column-start: 2;
grid-column: auto / 5;
}
The later shorthand resets the starting boundary to auto.
Confusing Rows and Columns
Use grid-row-start to define the starting boundary along the row axis.
Important Considerations
Keep the following points in mind when using grid-column-start:
- Purpose: Defines the starting boundary of a grid item along the column axis.
- Initial value:
auto. - Inheritance: The property is not inherited.
- Applies to: Grid items and absolutely positioned boxes whose containing block is a grid container.
- Grid lines: Identify boundaries between columns.
- Positive numbers: Count forward from the start of the explicit grid.
- Negative numbers: Count backward from the end of the explicit grid.
- Line zero: Invalid.
- Named lines: Can be referenced using custom identifiers.
- Repeated names: Can be distinguished using integer occurrences.
- Spanning: The
spankeyword defines the number of tracks occupied. - Span counts: Must be positive integers.
- Automatic placement: The
autovalue allows the grid placement algorithm to determine the starting boundary. - Ending boundary: Controlled by
grid-column-end. - Shorthand:
grid-columncombines the starting and ending boundaries. - Grid area:
grid-areacan specify both row and column placement. - Implicit columns: Can be generated when placement extends beyond the explicit grid.
- Column sizing: Controlled by
grid-template-columnsandgrid-auto-columns. - Responsive design: Check starting line references when column counts change.
- Overlapping: Items can overlap when their assigned grid areas intersect.
- Writing direction: Grid column numbering follows the logical inline axis.
- Accessibility: Visual placement does not change document reading order or keyboard focus order.
- Browser testing: Verify numbered lines, spans, named lines, and responsive behavior.
The grid-column-start property provides precise control over where grid items begin. It is useful for aligning content with specific columns, creating multi-column layouts, and adjusting item placement without changing the ending boundary.
Browser Support
The CSS grid-column-start property has Widely available support in modern browsers as part of CSS Grid Layout.
Modern versions of Chrome, Edge, Firefox, Safari, and other major browsers support numbered grid lines, negative line references, named lines, and the span keyword.
Standard Example
.container {
display: grid;
grid-template-columns: repeat(4, 1fr);
}
.item {
grid-column-start: 2;
grid-column-end: 4;
}
Legacy Browser Considerations
Internet Explorer implemented an older, prefixed CSS Grid model that used different placement properties, including -ms-grid-column. It does not support the modern grid-column-start property.
Browser Compatibility
For current compatibility details, visit Can I Use? and search for grid-column-start.
Specifications
The grid-column-start property is defined in the CSS Grid Layout specification.
CSS Grid Layout Module Level 1: grid-column-start
The specification defines numbered grid lines, named grid lines, spans, automatic placement, and the rules used to resolve grid item boundaries.
CSS Grid Layout Module Level 2
For additional documentation and examples, consult MDN Web Docs.
