π What is grid-column?
grid-column is a CSS Grid item property that controls the horizontal placement of a grid item. It allows you to choose where an item starts and ends across the gridβs column lines.
π Shorthand For
- grid-column-start
- grid-column-end
Meaning:grid-column: start / end;
π― Basic Syntax
grid-column Syntax
grid-column: <start-line> / <end-line>;π§ͺ Example: Spanning 2 Columns
Span Across Two Columns
.item {
grid-column: 1 / 3;
/* Starts at column line 1 and ends before column line 3 β spans 2 columns */
}
π₯ Using span Keyword
The span keyword lets you expand an item across multiple tracks.
Using span
.item {
grid-column: span 2;
/* span across 2 columns from its current position */
}Note
π Practical Example
Layout Example
.container {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 20px;
}
.header {
grid-column: 1 / 5; /* full width */
}
.sidebar {
grid-column: 1 / 2;
}
.content {
grid-column: 2 / 5;
}This layout creates:
β’ A full-width header
β’ A sidebar on the left
β’ A content area spanning the remaining columns
π§ Understanding Grid Lines
Grid lines are the numbered boundaries between tracks.

| Expression | Meaning |
|---|---|
| 1 / 3 | Start at line 1, end at line 3 β span 2 columns |
| 2 / 5 | Start at line 2, end at line 5 β span 3 columns |
| span 2 | Stretch across 2 columns automatically |
π§© Combining grid-column with grid-row
Grid Placement in 2D
.hero {
grid-column: 1 / 4;
grid-row: 1 / 3;
}This makes the item span multiple rows and columns β great for hero banners or feature blocks.
π± Responsive Use Case
Responsive grid-column
.card {
grid-column: span 2;
}
@media (min-width: 800px) {
.card {
grid-column: span 1;
}
}On smaller screens, cards span 2 columns. On larger screens, they return to a tighter layout.
β οΈ Common Mistakes
- Using column numbers that donβt exist in the grid
- Trying to use grid-column on the container instead of items
- Forgetting that the end line is exclusive (item stops before it)
- Using only one number (must be start/end or span)
Note
π₯ Summary
grid-column is a powerful property for controlling horizontal placement of grid items. It lets you create flexible, complex layouts with precision using grid lines or the span keyword.
Learn more β MDN Docs π