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.
In more detail
With many items, auto-fill and auto-fit look the same; the difference only shows when there are fewer items than columns. Choose auto-fill when you want items to keep a steady size and alignment, and auto-fit when you want them to stretch.
Related terms
- 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.
- 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.
Taught in
- Advanced CSS Grid: Named Areas, minmax And auto-fit — Frontend Architecture & Web Platform