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.
In more detail
The first argument is a count or a keyword, and the second is the track pattern to repeat. repeat(auto-fit, minmax(280px, 1fr)) is the classic responsive card grid.
Related terms
- 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.
- auto-fill — A repeat() keyword that creates as many tracks as fit the container and keeps the empty ones, leaving blank columns if there are few items.
Taught in
- Advanced CSS Grid: Named Areas, minmax And auto-fit — Frontend Architecture & Web Platform