Auto-fill vs auto-fit

It always takes me a second to remember which way round these are. Up to a point, they seem to work in the same way.

When using the minmax() function in a grid declaration, auto-fit will expand the grid items to fill the available space. auto-fill keeps the available space as if there was an grid item there.

I've found auto-fit to be useful where I've had two columns with different content and I want them to be the same width.

auto-fill is useful when you want to keep the grid items the same size but you want to fill the available space.

Here's the difference:

Auto-fit

1
2
3
4

Auto-fill

1
2
3
4