grid-template-columns
The CSS Grid properties that define the number and size of a grid's column tracks and row tracks.
In more detail
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) creates as many columns of at least 280px as fit, each growing to share the width. Setting grid-template-rows: subgrid instead makes an item reuse its parent's rows.
Related terms
- repeat() — A CSS Grid function that writes a track pattern many times, such as repeat(3, 1fr), or as many times as fit with auto-fit or auto-fill.
- minmax() — A CSS Grid function that lets a track size vary between a minimum and a maximum, such as minmax(280px, 1fr).
- auto-fit — A repeat() keyword that creates as many tracks as fit the container, then collapses empty ones so the filled tracks stretch to use the space.
- subgrid — A CSS Grid value that lets a nested grid use its parent grid's tracks instead of sizing its own, so content in separate cards lines up.
Taught in
- Advanced CSS Grid: Named Areas, minmax And auto-fit — Frontend Architecture & Web Platform
- CSS Subgrid: Inheriting Track Sizing Across Nested Layouts — Frontend Architecture & Web Platform