CSS grid-auto-columns Property

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

What You’ll Learn

The grid-auto-columns property controls how wide automatically created grid columns become when your layout needs more columns than you explicitly defined.

01

Implicit

Auto columns.

02

auto

Default size.

03

px / rem

Fixed width.

04

minmax

Min & max.

05

fr

Flexible tracks.

06

Container

Grid parent.

Introduction

The grid-auto-columns property in CSS is used in grid layouts to define the size of implicitly created columns. When items are placed outside the explicitly defined grid, new columns are created automatically.

The grid-auto-columns property specifies the size of these newly created columns, ensuring a consistent layout.

Definition and Usage

Set grid-auto-columns on a grid container alongside display: grid and grid-template-columns. Explicit columns come from your template; any extra columns the browser generates use the grid-auto-columns size. Pair with grid-auto-flow: column when items should fill rows first and spill into new columns.

💡
Beginner Tip

If all items fit within your grid-template-columns and you use default row flow, you may not see implicit columns. Add more items or change auto-flow to trigger new columns.

📝 Syntax

The syntax for the grid-auto-columns property is straightforward. You can specify a single value or multiple values separated by spaces:

syntax.css
element {
  grid-auto-columns: value;
}

Here, value can be any valid length, percentage, or keyword that defines the column size.

Basic Example

grid-auto-columns-basic.css
.grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-columns: 100px;
}
grid-auto-columns: 100px; grid-auto-columns: minmax(80px, 1fr); grid-auto-columns: max-content;

Default Value

The default value of the grid-auto-columns property is auto, which means the size of the implicitly created columns will be determined by the content inside them.

Syntax Rules

  • Applies to grid containers only, not individual grid items.
  • Accepts one or more track sizes separated by spaces for repeating patterns.
  • Affects implicit columns only; use grid-template-columns for explicit tracks.
  • The property is not inherited.
  • Often used with grid-auto-flow to control how items create implicit tracks.

⚡ Quick Reference

QuestionAnswer
Initial valueauto
Applies toGrid containers
InheritedNo
ControlsImplicit column size
Related propertygrid-template-columns

💎 Property Values

ValueDescription
lengthA specific size in units such as px, em, rem, etc.
percentageA percentage value relative to the grid container
autoAutomatically determines the column size based on the content
min-contentThe smallest size that fits the content
max-contentThe largest size that fits the content
fit-content()A function that defines the size within a specified limit
frA fraction of the available space

👀 Live Preview

Two explicit columns plus implicit columns at 4rem (items 5–6, highlighted):

1
2
3
4
5
6

Examples Gallery

Set implicitly created columns to 100 pixels, then explore minmax, content keywords, and a horizontal card strip.

🔢 Fixed Implicit Columns

Start with the reference example — implicit columns sized at 100 pixels.

Example 1 — 100px Auto Columns

Create a grid where extra columns beyond the template are 100px wide.

grid-auto-columns-100px.css
.grid-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-columns: 100px;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, auto);
  gap: 10px;
}
Try It Yourself

How It Works

The first two columns use the explicit 1fr 1fr template. When column flow needs a third column, grid-auto-columns: 100px sets its width.

Example 2 — minmax for Flexible Implicit Columns

Let implicit columns grow between a minimum and maximum size.

grid-auto-columns-minmax.css
.grid-container {
  grid-template-columns: 200px;
  grid-auto-columns: minmax(120px, 1fr);
  grid-auto-flow: column;
}
Try It Yourself

How It Works

minmax(120px, 1fr) ensures implicit columns are at least 120px but can grow to share leftover space.

📈 Content-Based Sizing

Use content keywords and fixed widths for galleries and data tables.

Example 3 — min-content vs max-content

Compare narrow and wide implicit column sizing based on content.

grid-auto-columns-content.css
.narrow-cols { grid-auto-columns: min-content; }
.wide-cols { grid-auto-columns: max-content; }
Try It Yourself

How It Works

min-content shrinks columns to the smallest fit; max-content expands to fit the longest content without wrapping.

♿ Accessibility

  • Ensure horizontal scroll areas are keyboard accessible when using column auto-flow galleries.
  • Do not rely on column width alone to convey data relationships; use table headers or labels.
  • Test zoom and small screens so implicit columns do not cause unreadable overflow.
  • Keep touch targets wide enough even when min-content shrinks columns.
  • Maintain logical tab order when items flow into implicit columns.

🧠 How grid-auto-columns Works

1

Explicit columns are defined

grid-template-columns sets the planned column tracks.

Template
2

Extra columns are needed

Auto-placement or item placement creates implicit columns beyond the template.

Implicit tracks
3

grid-auto-columns applies

Each new column uses the size you specified, such as 100px or minmax().

Sizing
=

Consistent extra columns

Implicit columns stay uniform even as the grid grows horizontally.

🖥 Browser Compatibility

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

Baseline · Modern browsers

grid-auto-columns everywhere

Implicit column sizing 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-auto-columns property 97% supported

Bottom line: Safe for modern projects. Combine with display: grid and explicit column templates.

🎉 Conclusion

The grid-auto-columns property is a useful tool for managing the size of implicitly created columns in a grid layout. By defining the size of these columns, you can ensure that your grid layout remains consistent and visually appealing, even when new columns are added automatically.

Experiment with different values to see how this property can enhance the flexibility and responsiveness of your grid designs. Start with fixed pixels, then try minmax() and content keywords for smarter sizing.

💡 Best Practices

✅ Do

  • Define explicit columns with grid-template-columns
  • Set grid-auto-columns for overflow cases
  • Use minmax() for flexible implicit tracks
  • Pair with grid-auto-flow: column for horizontal layouts
  • Test with enough items to trigger implicit columns

❌ Don’t

  • Confuse with grid-template-columns
  • Apply on grid items instead of containers
  • Expect changes without implicit columns
  • Use tiny min-content for touch targets
  • Forget overflow handling on small screens

Key Takeaways

Knowledge Unlocked

Five things to remember about grid-auto-columns

Use these points when sizing implicit columns.

5
Core concepts
auto 02

Default auto

Content size.

Default
100px 03

Fixed width

Length units.

Syntax
minmax 04

Flexible

Min & max.

Pattern
template 05

Explicit first

Then auto cols.

Workflow

❓ Frequently Asked Questions

grid-auto-columns sets the size of columns that are created automatically when grid items need more columns than grid-template-columns defines.
The default value is auto, which sizes implicit columns based on their content.
Explicit columns come from grid-template-columns. Implicit columns are generated when placement or auto-flow creates extra columns beyond those definitions.
grid-template-columns defines the main column tracks you plan for. grid-auto-columns only affects extra columns the browser creates when needed.
It applies when the grid creates implicit columns, such as when grid-auto-flow is column or when items are placed on column lines beyond the explicit template.

Practice in the Live Editor

Open the HTML editor, change grid-auto-columns values, and watch how implicit columns resize.

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