Unfortunately, neither of the two solutions I explored successfully resolved this issue. However, I am sharing my findings in hopes of sparking inspiration for other potential answers. (I recommend viewing these demos on the "full page" setting to see them properly; please note that the example images are of differing dimensions).
A simple flexbox configuration disrupts the aspect ratio:
.images {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.images > .img { position: relative; }
.images > .img > img { height: 100%; }
<div class="images">
<img src="https://hddesktopwallpapers.in/wp-content/uploads/2015/09/bison-image-680x425.jpg" />
<img src="https://cdn101.picsart.com/208783124002202.jpg?type=webp&to=min&r=640" />
</div>
Introducing an additional container around each image results in an intriguing scenario where the aspect ratio is maintained, but bounding issues arise:
.images {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
}
.images > .img { position: relative; }
.images > .img > img { height: 100%; }
<div class="images">
<div class="img">
<img src="https://hddesktopwallpapers.in/wp-content/uploads/2015/09/bison-image-680x425.jpg" />
</div>
<div class="img">
<img src="https://cdn101.picsart.com/208783124002202.jpg?type=webp&to=min&r=640" />
</div>
</div>
If you can specify a fixed height, using height: 100%
can quickly resolve this issue:
.images {
position: relative;
font-size: 0;
height: 200px;
white-space: nowrap;
}
.images > img { height: 100%; }
<div class="images">
<img src="https://hddesktopwallpapers.in/wp-content/uploads/2015/09/bison-image-680x425.jpg" />
<img src="https://cdn101.picsart.com/208783124002202.jpg?type=webp&to=min&r=640" />
</div>