I have a gallery of images that looks great on a full-size PC screen. However, when I resize it for viewing on a phone, the aspect ratio is not maintained and the images only stretch in width.
Currently, this is how it appears: https://gyazo.com/a1f605bb410865579025644b0a267adf
Additionally, you may notice that at certain points, the gallery transitions from showing one image to two images briefly before settling back to one image permanently. How can I resolve this issue?
This is the CSS code being used:
#images{
display: flex;
flex-wrap: wrap;
}
.image{
display: flex;
flex: 1;
margin: 5px;
min-width: 250px;
min-height: 187.5px;
object-fit: contain;
}
.image > img{
flex: 1;
}
And here is the HTML code:
<div id="images">
<div class="image">
<img src="f1.jpg">
</div>
<div class="image">
<img src="f2.jpg">
</div>
<div class="image">
<img src="f3.jpg">
</div>
<div class="image">
<img src="f1.jpg">
</div>
//the above structure continues
//it's currently temporary and will be replaced with a loop.
</div>