CSS grid-column Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Layout

What You’ll Learn

The grid-column property lets you control how many columns a grid item spans and where it starts and ends horizontally.

01

Span cols

Width control.

02

1 / 3

Line numbers.

03

span 2

Column count.

04

Shorthand

Start & end.

05

auto

Default flow.

06

Grid item

Child element.

Introduction

The grid-column property in CSS is used in the context of CSS Grid Layout. It allows you to define how many columns an element should span within a grid container, and which columns it should start and end at.

This property simplifies the process of positioning elements within a grid, making layout design more flexible and efficient.

Definition and Usage

Apply grid-column on a child of a grid container (an element with display: grid). Use line numbers like 1 / 3 when you need precise placement. Use span 2 when you only care how many columns an item should cover.

💡
Beginner Tip

Grid column lines are numbered starting at 1. So grid-column: 1 / 3 spans from line 1 to line 3, covering two column tracks.

📝 Syntax

The grid-column property can be defined using two different syntax formats: the shorthand syntax and the longhand syntax.

Shorthand Syntax

syntax-shorthand.css
element {
  grid-column: start / end;
}
  • start — The starting grid line for the column.
  • end — The ending grid line for the column.

Longhand Syntax

The grid-column property can also be set using the longhand properties grid-column-start and grid-column-end:

syntax-longhand.css
element {
  grid-column-start: start;
  grid-column-end: end;
}
grid-column: 1 / 3; grid-column: span 2; grid-column: 1 / -1;

Default Value

The default value for the grid-column property is auto, which means the item will be placed in the next available grid cell.

Syntax Rules

  • Applies to grid items (children of a grid container), not the container itself.
  • Shorthand for grid-column-start and grid-column-end.
  • Accepts line numbers, span n, named lines, and auto.
  • The property is not inherited.
  • Negative line numbers count from the end of the grid (for example, -1 is the last line).

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toGrid items
InheritedNo
Shorthand forgrid-column-start / grid-column-end
Full-width trickgrid-column: 1 / -1;

💎 Property Values

ValueDescription
autoThe element will be placed in the next available grid cell
span nThe element will span n columns
line numberSpecifies the starting or ending line number of the grid
nameA named grid line defined in the grid template

👀 Live Preview

Item 1 spans columns 1–2 with grid-column: 1 / 3 (highlighted):

1
2
3
4

Examples Gallery

Place items with line numbers and span, then try full-width banners and a sidebar layout.

🔢 Column Placement

Start with the reference example — line numbers and span values on a four-column grid.

Example 1 — Line Numbers and Span

Position items using column line numbers and the span keyword.

grid-column-lines.css
.item1 { grid-column: 1 / 3; }
.item2 { grid-column: 3 / 5; }
.item3 { grid-column: span 2; }
Try It Yourself

How It Works

Item 1 spans from line 1 to 3 (two columns). Item 2 spans lines 3 to 5. Item 3 uses span 2 to cover two columns from its auto-placed start.

Example 2 — Hero Card with span 2

Make a featured card twice as wide as its neighbors.

grid-column-span.css
.hero {
  grid-column: span 2;
}
Try It Yourself

How It Works

span 2 tells the hero card to cover two column tracks without needing exact line numbers.

📈 Layout Patterns

Common real-world uses for column placement in page layouts.

Example 3 — Full-Width Banner

Stretch an item across every column using negative line numbers.

grid-column-full.css
.banner {
  grid-column: 1 / -1;
}
Try It Yourself

How It Works

1 / -1 starts at the first column line and ends at the last line, spanning the full grid width.

Example 4 — Sidebar and Main Content

Place a sidebar in the first column and main content across the remaining columns.

grid-column-sidebar.css
.sidebar { grid-column: 1 / 2; }
.main { grid-column: 2 / 4; }
Try It Yourself

How It Works

The sidebar occupies column 1. Main content spans columns 2 and 3 using lines 2 and 4.

♿ Accessibility

  • Keep DOM order logical even when visual column placement changes reading flow.
  • Do not rely on column position alone to convey meaning; use headings and labels.
  • Test keyboard tab order when spanning items reorder the visual layout.
  • Ensure full-width banners do not skip important navigation for screen reader users.
  • Use semantic HTML such as <main> and <aside> alongside grid placement.

🧠 How grid-column Works

1

Grid columns are defined

grid-template-columns creates column tracks on the container.

Template
2

Item gets grid-column

You set start and end lines or a span on a grid item.

Placement
3

Browser spans columns

The item stretches across the specified column tracks horizontally.

Span
=

Precise horizontal layout

Items cover exactly the columns you need for banners, heroes, and sidebars.

🖥 Browser Compatibility

The grid-column property is widely supported in modern browsers, including recent versions of Chrome, Firefox, Safari, Edge, and Opera.

Baseline · Modern browsers

grid-column everywhere

Column placement works in all major modern grid implementations.

97% Modern browser support
Google Chrome 57+ · Desktop & Mobile
Full support
Mozilla Firefox 52+ · Desktop & Mobile
Full support
Apple Safari 10.1+ · macOS & iOS
Full support
Microsoft Edge 16+ · 79+ Chromium
Full support
Opera 44+
Full support
grid-column property 97% supported

Bottom line: Safe for modern projects. Test spanning layouts across browsers for consistent rendering.

🎉 Conclusion

The grid-column property is a powerful feature of CSS Grid Layout that provides precise control over the placement of elements within a grid. By defining the start and end positions of an element, you can create complex and responsive layouts with ease.

Experiment with different grid configurations to see how this property can enhance your web designs. Start with line numbers, then try span and 1 / -1 for common layout patterns.

💡 Best Practices

✅ Do

  • Use line numbers for precise placement
  • Use span n for flexible column counts
  • Use 1 / -1 for full-width sections
  • Pair with semantic HTML elements
  • Test responsive behavior at smaller widths

❌ Don’t

  • Apply on grid containers instead of items
  • Confuse column lines with column count
  • Forget that line numbering starts at 1
  • Break reading order without testing a11y
  • Overuse spanning on mobile layouts

Key Takeaways

Knowledge Unlocked

Five things to remember about grid-column

Use these points when placing items horizontally.

5
Core concepts
auto 02

Default auto

Next cell.

Default
1/3 03

Line numbers

Start & end.

Syntax
span 04

span 2

Two columns.

Pattern
item 05

Grid item

Not container.

Scope

❓ Frequently Asked Questions

grid-column is a shorthand that sets where a grid item starts and ends horizontally, controlling which columns the item spans.
The default is auto, which places the item in the next available grid cell according to the grid auto-placement flow.
grid-column-start sets only the starting column line. grid-column is shorthand for both grid-column-start and grid-column-end in one declaration.
The item spans two columns starting from its auto-placed or explicitly set starting position.
grid-column controls column placement only. grid-area can set both row and column placement, or assign a named area from grid-template-areas.

Practice in the Live Editor

Open the HTML editor, change grid-column values, and watch items span different columns.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful