I'm looking to create 2 images with different widths that are displayed at the same height side-by-side, preferably using a flex box.
The method below works if I have the image dimensions (962x706 and 962x1275).
Is there a way to achieve this without knowing the dimensions in advance?
<div style="display: flex; margin: 0 -5px">
<div style="flex: calc(962/706); margin: 0 5px">
<img src="https://i.sstatic.net/H7QKE.jpg"/>
</div>
<div style="flex: calc(962/1275); margin: 0 5px">
<img src="https://i.sstatic.net/nsyuX.jpg"/>
</div>
</div>
img {
width: 100%;
}
You can check out a live example here: https://jsfiddle.net/b1f6v3kc/