function

repeat() — CSS reference

Repeats track definitions, reducing duplication. A fixed count may repeat flexible or intrinsic track sizes. Automatic repetitions have stricter sizing grammar so a repetition count can be determined. Named lines can be repeated as part of the fragment. Nested repeat() is not allowed.

Formal Syntax & Structure

css syntaxcss
repeat(<positive-integer>, <track-list fragment>) | repeat(auto-fill | auto-fit, <fixed-size track fragment>)

Working Example

Example Snippetcss
<!doctype html><html lang="en"><meta charset="utf-8"><title>repeat()</title><style>body{margin:0}#g{display:grid;width:300px;grid-template-columns:repeat(3, 1fr);}#g>*{background:#146e73;color:white;box-sizing:border-box}#b{background:#345d8e}#c{background:#79518e}</style><body><div id="g"><div id="a">A</div><div id="b">B</div><div id="c">C</div></div></body></html>
CSS Reference