Auto-fit

noun

say it: “AW-toh FIT” /ˈɔtoʊ fɪt/

A keyword for repeat() that fits as many columns as there is room for, then stretches the items to fill the row when there are only a few.

What does auto-fit do in a grid?

auto-fit fits as many columns as there is room for, then stretches the items to fill the row when there are only a few.

.team { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

In a sentence

  • “With auto-fit, the three team photos stretch across the whole row instead of leaving empty columns.”

Level: Journeyman · More CSS terms at this level

Updated