Looking for a way to display two portrait images side by side within a flexible container with 100% width? The challenge I'm facing is accommodating varying widths of the images while ensuring they are the same height.
<div class="container">
<p>Some Text</p>
<img src="this-is-a-landscape-image.jpg" alt="test"/>
<p> Some Text again</p>
<img class="portait" src="this-is-a-portrait-image.jpg" alt="test"/>
<img class="portrait" src="this-is-a-portrait-image.jpg" alt="test"/>
</div>
The issue at hand: I need to fit two images with the .portrait class into a responsive layout where the container's width is set at 100%. While the heights should be the same, the widths can vary due to different ratios of the images.
Is there a CSS solution using flexbox or perhaps a bit of JS that can achieve this without hardcoding the values as the content is generated dynamically through a CMS?
Do you have any innovative ideas to tackle this challenge?