CSS grid-template-columns Property

Beginner
6 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The grid-template-columns property sets the size (and optional line names) of the explicit column tracks on a grid container (display: grid).

The initial value is none. Pair it with grid-template-rows for rows, or use the grid-template shorthand. Implicit columns use grid-auto-columns.

Standard-track.

Not deprecated and not experimental. Baseline widely available with CSS Grid. The subgrid value is newer—check support if you rely on it.

CSS Syntax

syntax.css
grid-template-columns: none | <track-list> | subgrid | initial | inherit;

A track list is one or more sizes such as 100px, 1fr, auto, minmax(), or repeat().

Property Values

ValueDescriptionTry it
noneDefault. No explicit columnsTry it
<length> / %Fixed or percentage column widthTry it
<fr>Share of remaining free spaceTry it
minmax() / repeat()Range size, or repeat a track patternTry it
initialResets to noneTry it
inheritTakes the parent value (not inherited by default)Try it

How to Use grid-template-columns

List one size per column, left to right.

  1. Set display: grid on the container.
  2. Write column sizes: grid-template-columns: 100px 1fr 1fr;.
  3. Use repeat(n, 1fr) for equal columns.
  4. Use minmax(min, max) when a column needs a floor and a ceiling.
ValueResult
80px 1frFixed sidebar + flexible main
1fr 1fr 1frThree equal columns
repeat(3, 1fr)Same as three 1fr tracks
minmax(100px, 1fr) 2frFirst column at least 100px; second gets twice the free space

Live Preview

Change only grid-template-columns. Four items fill the tracks in order.

fr shares leftover space after fixed tracks. none means no explicit columns.

Columns
1
2
3
4

grid-template-columns: 1fr 1fr 1fr

CSS Examples

Each snippet focuses on grid-template-columns. Use Try It Yourself for a live editor.

Example 1 — Fixed + Flexible

A length sizes one column; 1fr takes the rest.

CSS
<style>
  .grid {
    display: grid;
    grid-template-columns: 80px 1fr;
  }
</style>

<div class="grid">
  <div>1</div><div>2</div>
  <div>3</div><div>4</div>
</div>
Try It Yourself

How It Works

  1. Two tracks. The value lists two column sizes, so the grid has two columns.
  2. Fixed first. 80px locks the first column width.
  3. Flexible second. 1fr takes the remaining free space.
  4. Items flow in order. 1 and 2 fill row one; 3 and 4 fill row two.

Example 2 — Equal Columns with repeat()

repeat(3, 1fr) is a short form of 1fr 1fr 1fr.

CSS
<style>
  .grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
</style>

<div class="grid">
  <div>1</div><div>2</div><div>3</div>
  <div>4</div><div>5</div><div>6</div>
</div>
Try It Yourself

How It Works

  1. Count first. repeat(3, …) builds three identical tracks.
  2. Equal share. Each track is 1fr, so free space splits three ways.
  3. Same as listing. This matches writing 1fr 1fr 1fr by hand.
  4. Six items, two rows. Items wrap to the next row after three columns.

Example 3 — minmax()

Give a column a minimum width while still allowing it to grow.

CSS
<style>
  .grid {
    display: grid;
    grid-template-columns: minmax(80px, 1fr) 2fr;
  }
</style>

<div class="grid">
  <div>1</div><div>2</div>
  <div>3</div><div>4</div>
</div>
Try It Yourself

How It Works

  1. Floor and flex. minmax(80px, 1fr) never shrinks below 80px and can grow with free space.
  2. Larger second share. 2fr gets twice as much free space as a 1fr track.
  3. Two columns. Items still place left to right, then wrap.
  4. Useful for sidebars. Keeps a readable minimum without locking a fixed width forever.

Edge Cases & Pitfalls

Explicit columns are only half the story. Watch free space and implicit tracks.

fr

fr shares leftover space

Fixed lengths are resolved first. Then fr tracks divide what remains—not the full container width by default.

none

none still allows implicit columns

With none, columns appear as needed and size via grid-auto-columns.

%

Percentages need a definite container size

If the grid’s inline size depends on its tracks, browsers may treat a percentage like auto.

auto-fit

auto-fill vs auto-fit

Both pack as many tracks as fit. auto-fit collapses empty tracks so flexible tracks can expand into that space.

subgrid

subgrid inherits the parent track sizes

Use it only inside a nested grid that spans parent tracks. Support is solid in modern browsers, but verify if you target older ones.

Browser Support

grid-template-columns is a browser style property for CSS Grid. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

grid-template-columns

Chrome 57+, Firefox 52+, Safari 10.1+, Edge 16+, Opera, Samsung Internet 6+. Not supported in Internet Explorer.

96% global support
Google Chrome 57+
Full support
Mozilla Firefox 52+
Full support
Apple Safari 10.1+
Full support
Microsoft Edge 16+
Full support
Opera 44+
Full support
Samsung Internet 6+
Full support
Internet Explorer All
Not supported
grid-template-columns Supported with modern CSS Grid

Bottom line: Safe for modern grid layouts. No vendor prefix is required in current browsers.

Key Takeaways

  • Role: define explicit column count and widths.
  • fr: shares free space after fixed tracks.
  • Helpers: repeat() for patterns; minmax() for ranges.
  • Implicit: overflow columns use grid-auto-columns, not this property.

One line: grid-template-columns lists the widths of your explicit grid columns, left to right.

Frequently Asked Questions

It defines how many explicit column tracks a grid has and how wide each track is.
none — no explicit columns. Extra columns come from grid-auto-columns when items need them.
One share of the free space left after fixed-size tracks are sized. Two 1fr columns split that space evenly.
A compact way to write 1fr 1fr 1fr — three equal flexible columns.
grid-template-columns sizes the explicit columns you declare. grid-auto-columns sizes implicit columns created by overflow or placement.
Baseline widely available: Chrome 57+, Firefox 52+, Safari 10.1+, Edge 16+. It is a browser style property, not a Node.js feature.

Next: grid-template-rows

Apply the same track-sizing ideas to rows.

grid-template-rows tutorial →

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.

8 people found this page helpful