css if grid overflow add use next row code example

Example 1: css grid auto wrap

this one will provide a more responsive behavior as you can specify the
minimum size to start wrapping and max size so it grows and adapts to 
bigger screens

grid-template-columns: repeat(auto-fill, minmax(300px, 3fr));

Example 2: generate random grid in css

<ul class="wrapper">
   <li><img src="https://placehold.it/200x300" alt="placeholder"></li>
   <li class="landscape"><img src="https://placehold.it/350x200" alt="placeholder"></li>
   <li class="landscape"><img src="https://placehold.it/350x200" alt="placeholder"></li>
   <li class="landscape"><img src="https://placehold.it/350x200" alt="placeholder"></li>
   <li><img src="https://placehold.it/200x300" alt="placeholder"></li>
   <li><img src="https://placehold.it/200x300" alt="placeholder"></li>
   <li class="landscape"><img src="https://placehold.it/350x200" alt="placeholder"></li>
   <li><img src="https://placehold.it/200x300" alt="placeholder"></li>
   <li><img src="https://placehold.it/200x300" alt="placeholder"></li>
   <li><img src="https://placehold.it/200x300" alt="placeholder"></li>
</ul>

Tags:

Css Example