After sorting through dozens of Flexbox questions on this website with no luck, I figure it's time to just ask.
I want a row of images where the row stretches the entire width of the window, each image is the same height, and all images maintain their original aspect ratios. As an example, I have:
ul {
width: 100%;
list-style-type: none;
padding: 0;
display: flex;
align-items: stretch;
}
li {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
}
img {
max-height: 100%;
max-width: 100%;
object-fit: contain;
}
<ul>
<li>
<img src="https://dummyimage.com/1920x1080"/>
</li>
<li>
<img src="https://dummyimage.com/1400x1000"/>
</li>
<li>
<img src="https://dummyimage.com/500"/>
</li>
</ul>
The question Maintain image aspect ratio when changing height is very similar, but the problem with those answers is that all the images are the same aspect ratio.