css grid put max amount of divs before resizing code example
Example 1: repeat autofill css grid minmax
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
Example 2: generate random grid in css
.wrapper {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
grid-gap: 10px;
grid-auto-flow: dense;
list-style: none;
margin: 1em auto;
padding: 0;
max-width: 800px;
}
.wrapper li {
border: 1px solid #ccc;
}
.wrapper li.landscape {
grid-column-end: span 2;
}
.wrapper li img {
display: block;
object-fit: cover;
width: 100%;
height: 100%;
}