I'm trying to position the images side by side without any gaps using CSS Grid. However, I noticed that there is a default gap between the columns and rows.
Here is the code I used:
<div class="grid-container">
<figure class="grid_item grid_item-1">
<img class="grid_image" src="image-url" alt="">
</figure>
<figure class="grid_item grid_item-2">
<img class="grid_image" src="image-url" alt="">
</figure>
<figure class="grid_item grid_item-3">
<img class="grid_image" src="image-url" alt="">
</figure>
<figure class="grid_item grid_item-4">
<img class="grid_image" src="image-url" alt="">
</figure>
<figure class="grid_item grid_item-5">
<img class="grid_image" src="image-url" alt="">
</figure>
<figure class="grid_item grid_item-6">
<img class="grid_image" src="image-url" alt="">
</figure>
</div>
CSS
.grid-container {
display: grid;
grid-template-columns : repeat(2,1fr);
}
.grid_image {
width:100%;
height:100%;
object-fit:cover;
}
You can view my output on Codepen here: Codepen Output