Found the answer in the following links:
How to keep wrapped flex-items the same width as the elements on the previous row?
https://www.w3schools.com/cssref/tryit.asp?filename=trycss_grid-row-gap