grid-template-columns

W3C CSS Snapshot 2026

Define the explicit columns. List track sizes from inline-start to inline-end.

On this page

Syntax and values

Value or syntaxWhat it does
noneThe initial value. This property declares no explicit tracks.
120px / 25%Sets a fixed length or a percentage of the relevant container size. A percentage can behave like auto when the size depends on its tracks.
1fr / 2frUses a fraction of the available space. A track with 2fr takes a twice-as-large share as 1fr when neither is limited by its minimum.
auto / min-content / max-contentSizes the track from its items. min-content uses their minimum intrinsic contribution and max-content uses their maximum intrinsic contribution.
minmax(80px, 1fr)Keeps the track at least 80px wide or tall and lets it share the remaining space.
fit-content(180px)Uses the content size with an upper limit of 180px when the automatic minimum allows it.
repeat(3, 1fr)Creates three tracks using the same size. auto-fit or auto-fill can repeat columns according to the available space.
subgridUses the parent grid’s tracks on this axis for a grid item that is itself a grid container.

Try the example

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>grid-template-columns example</title>
  <style>
.layout { display: grid; width: min(100%, 320px); border: 2px solid teal; box-sizing: border-box; }
.layout > div { padding: 8px 12px; background: #def5f5; color: #123; border: 1px solid #81b9b5; box-sizing: border-box; }
.layout { grid-template-columns: 1fr 2fr; gap: 6px; }
  </style>
</head>
<body>
<div class="layout">
  <div class="first">A</div>
  <div class="second">B</div>
  <div>C</div>
</div>
</body>
</html>

What to expect B has a wider column than A. Make both columns 1fr to give them equal space.

Official references