← Back to functions

CSS Function

repeat()

Grid

Repeats a grid track pattern a specified number of times.

Syntax

repeat(count, track-list)

Example

grid-template-columns: repeat(3, 1fr);

Common use cases

  • Creating equal-width grid columns
  • Responsive grids with auto-fill or auto-fit
  • Reducing repetition in grid definitions

Practical developer insight

repeat(auto-fill, minmax(200px, 1fr)) creates a responsive grid where columns are at least 200px wide and fill the container — no media queries needed.

Related