I have a grid layout (display: grid) that is 4 cells wide. When there's only two rows, the spacing between them is larger than it's supposed to be. If there's three or more rows, everything looks like it should. This is basically what the html looks like:
<div class="thumbnail-container">
<div class="thumbnail-grid">
<div class="thumbnail-grid-cell"></div>
<div class="thumbnail-grid-cell"></div>
<div class="thumbnail-grid-cell"></div>
<!-- and so on... -->
</div>
</div>
These are my css rules:
.thumbnail-container {
overflow: scroll;
}
.thumbnail-grid {
display: grid;
grid-template-columns: auto auto auto auto;
grid-row-gap: 5px;
grid-column-gap: 5px;
height: 250px;
margin: 8px;
}
.thumbnail-grid-cell {
width: 100px;
height: 100px;
border: 1px solid black;
position: relative;
}
Just to clarify:
This is what it looks like with 2 rows:
This is is what it looks like with 3 rows:
The column spacing is always correct.