CSS Grid: Create Flexible Layouts Using auto-fill
The repeat function comes with a option called auto-fill.
This allows you to automatically insert as many rows or columns of your
desired size as possible depending on the size of the container.
You
can create flexible layouts when combining
auto-fill with minmax.
In the preview,
grid-template-columns in the first grid container is set torepeat(auto-fill, minmax(60px, 1fr));
first container
1
2
3
4
5
second container
1
2
3
4
5
compare between first and second grid by stretching and minimizing the web-page
If your container can't fit all your items on one row, it will move them down to a new one.
source
Comments
Post a Comment