Grid-template-columns
The CSS grid-template-columns property defines the sizes and optional names of a grid’s column tracks and grid lines.
Web Design Playground, Second Edition
The CSS grid-template-columns property specifies the number, sizes, and track definitions of a grid's columns.
- How it is used
- Defines column counts and widths for CSS Grid layouts, including a centered portfolio-page container.
- How deep it goes
- Explains space-separated sizing values and works through fixed-width and fractional columns, without descending into browser layout internals.
- Examples
- Shows a three-column grid sized 100px, 200px, and 300px, plus a portfolio layout using `1fr auto 1fr`.
- What you can do after
- Build it from scratch: specify grid-column widths and center page content in an automatically sized middle column.
Read how Web Design Playground, Second Edition explains grid-template-columns →
CSS in Depth, Second Edition
The CSS grid-template-columns property defines the sizes and optional names of a grid container's column tracks and grid lines.
- How it is used
- Defines column widths and lines for grid layouts, from equal-sized boxes to a main-content-and-sidebar page.
- How deep it goes
- Works through fraction-based sizing, mixed widths, named lines, repeated patterns, and parent-line inheritance with subgrid.
- Examples
- Uses a six-item grid, a main-content-and-sidebar page, and repeated named column lines.
- What you can do after
- Build it from scratch: size grid columns and name their boundaries for item placement.
Read how CSS in Depth, Second Edition explains grid-template-columns →
Tiny CSS Projects
The CSS grid-template-columns property defines the sizes and number of columns in a grid.
- How it is used
- Defines the number and sizes of columns on a grid container.
- How deep it goes
- Works through track lists, repeated columns, minimum widths, and fractional sizing without detailing browser layout algorithms.
- Examples
- Uses a three-column `main` layout and equal-versus-unequal `fr` shares to demonstrate track sizing.
- What you can do after
- Build it from scratch: define fixed and flexible columns on a CSS Grid container.
Build a Website with ChatGPT
The CSS grid-template-columns property defines the number and widths of columns in a grid container.
- How it is used
- Uses CSS Grid to place article and aside content in proportionally sized columns.
- How deep it goes
- Explains fractional units and editable ratios, while deferring complete small-screen responsiveness.
- Examples
- Demonstrates article-and-aside layouts using 2fr 1fr, 3fr 1fr, and 1fr 2fr.
- What you can do after
- Apply it via CSS to create and customize a two-column article layout.
Read how Build a Website with ChatGPT explains grid-template-columns →
Also covered in
What to know first
- flexboxFlexbox is a CSS one-dimensional layout model for arranging, sizing, aligning, and distributing items along a row or column.
- CSS GridCSS Grid is a CSS layout system for arranging elements in two-dimensional rows and columns.
Related concepts
- CSS Gridconfigures · CSS Grid is a CSS layout system for arranging elements in two-dimensional rows and columns.
- explicit gridconfigures · An explicit grid is the portion of a CSS Grid whose rows and columns are directly defined by grid-template properties.
- explicit track creationconfigures · Explicit track creation is the definition of grid rows or columns directly by a grid declaration.
- fr unitused by · The CSS fr unit is a flexible Grid track-sizing unit representing a share of the grid container’s leftover free space.
- grid containerconfigures · A grid container is an element whose display mode establishes a CSS Grid formatting context for laying out its child elements as grid items.
Questions about grid-template-columns
What is grid-template-columns?
The CSS grid-template-columns property defines the sizes and optional names of a grid’s column tracks and grid lines.
Which Manning books explain grid-template-columns?
Web Design Playground, Second Edition, CSS in Depth, Second Edition, Tiny CSS Projects and Build a Website with ChatGPT.
What should I know before learning grid-template-columns?
Manning books that teach grid-template-columns usually introduce flexbox and CSS Grid first.
What is grid-template-columns part of?
Grid-template-columns is part of grid template. A grid template is a specification of the number and dimensions of columns and rows in a grid layout.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.



