I got three photos, which are arranged in two columns :
- The left column contains 1 photo, which is a portrait (width < height)
- The right columns contains 2 photos of the exact same size, which are landascapes (width > height)
I would like to make the two columns equal in term of height, such as the height of the left column is equal of the height of the right column.
Since I cannot crop the photos, I have to use the width of columns to make them equal height (which means they are not 50%/50%).
You can see an example here:
<div class="container">
<div class="left">
<img src="https://placehold.it/400x900" alt="">
</div>
<div class="right">
<img src="https://placehold.it/500x400" alt="">
<img src="https://placehold.it/500x400" alt="">
</div>
</div>
And the associated CSS:
img {
margin-bottom: 16px;
max-width: 100%
}
.container {
width: 700px; /* Container width is fixed */
display: flex;
}
.left {
width: 52%; /* I want to change this */
margin-right: 16px;
}
.right {
display: flex;
flex-grow: 1;
flex-direction: column
}
Live example: https://jsfiddle.net/9f2gom0q/
At the moment, the only solution I found was to manually fix the width of one of the columns, which does sound right and may broke the grid if the photos change.
Does flex-based solution exist ?