I am making a site like Google Photos in that there is a Home page where I show all the photos uploaded by the user and it looks like this:-
The problem is when there is a big photo in a row (like the image in the middle of 1st row is big) because of that image the image in the next row has that huge gap. Is there any way it should automatically fill in the gaps if it's there! This is the code:-
(I am using Django to fetch the images from the server)
HTML:-
<div class="container">
<div class="upload" id="upload" style="display: none">
<form action="/upload" method="post" enctype="multipart/form-data">{%csrf_token%}
<input type="file" name="image">
<button type="submit" class="btn btn-outline-danger">Upload</button>
</form>
</div>
{%for date, image_list in image_day reversed%}
<div class="home">
<h4 class="date">{{date}}</h4>
</div>
<div class="image-gallery">
<div class="row">
{%for i in image_list reversed%}
<div class="col-md-4" style="padding-top: 1%; padding-bottom: 1%;">
<img class="img1" id="img1" src="/media/{{i.image}}" style="width: 100%;"
onclick="popup('/media/{{i.image}}')">
</div>
{%endfor%}
</div>
</div>
{%endfor%}
</div>
CSS:-
<style>
@import url('https://fonts.googleapis.com/css2?family=Poppins&display=swap');
.home {
font-family: 'Poppins';
padding-top: 3%;
}
.img1 {
-webkit-transform: scale(1);
transform: scale(1);
-webkit-transition: .3s ease-in-out;
transition: .3s ease-in-out;
}
.image-gallery {
padding-top: 1%;
}
.img1:hover {
opacity: 0.9;
}
.upload {
padding-top: 3%;
}
</style>
Please, Let me know if you want any more information!