I'm having trouble making sure the images inside the parent container fill 100% of the available space without leaving a gap below the last image. The photos have varying sizes and aspect ratios, so it's been challenging to achieve this.
My goal is to eliminate the red background by ensuring that the available space is completely filled with the images. Any suggestions on how I can accomplish this?
Here is what I am aiming for:
This is my current code:
.home-photos-grid {
width: 1200px;
-webkit-column-count: 1;
-moz-column-count: 1;
column-count: 1;
-moz-column-gap: 0;
-webkit-column-gap: 0;
margin-bottom: 0;
background: #D33383;
}
.home-photos-grid .post-image {
margin: 0;
padding: 0;
display: inline-block;
width: 100%;
float: left;
}
.post-image img {
width: 100%;
}
@media only screen and (min-width: 740px) {
.home-photos-grid {
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
}
<div class="home-photos-grid">
<div class="post-image">
<img src=" https://unsplash.it/500?image=123&gravity=east" />
</div>
<div class="post-image">
<img src="https://picsum.photos/500/400/?image=70" />
</div>
<div class="post-image">
<img src="https://picsum.photos/500/400/?image=50" />
</div>
<div class="post-image">
<img src="https://picsum.photos/500/400/?image=60" />
</div>
</div>
Appreciate any help or advice you can offer!