.flex {
display: flex;
align-items: stretch;
}
.dblCol {
border: 1px solid #999;
flex-grow: 2;
min-width: 0;
padding: 0 10px;
}
.sglCol {
border: 1px solid #999;
flex-basis: 33.33333333%;
max-width: 33.33333333%;
width: 33.33333333%;
flex: 0 0 auto;
box-sizing: border-box;
padding: 0 10px;
}
img {
max-width: 100%;
width: 100%;
height: 150px; /* height can be fix */
}
/* surrounding styles */
body {
background-color: #ccc;
}
.content {
width: 1000px;
margin: 0 auto;
}
.app {
position: relative;
background-color: #fff;
padding: 30px 40px 40px;
margin-bottom: 30px;
}
<div class="content">
<div class="app">
<div class="flex">
<div class="dblCol">
<h3>Teaser #1</h3>
<img src="https://assets9.domestika.org/project-items/001/654/589/lorem_vector-big.png?1467128294" />
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>
</div>
<div class="sglCol">
<h3>Teaser #2</h3>
<img src="https://cdn-www.enfocus.com/sites/combell-www.enfocus.com/files/media/blog/2017-08-09-Lorem-Ipsum/lorem-ipsum.jpg"/>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam</p>
</div>
</div>
</div>
</div>
I'm utilizing the flexibility of flexbox for relative column widths. In this scenario, the right column occupies 33% width while the left column expands to fill the remaining space.
The objective here is to ensure that images inside these columns are displayed with consistent heights, which can be a fixed pixel value. However, the image width should stretch to 100% without distorting its aspect ratio. The goal is to display only the center portion of the image as effectively as possible.
Improper Image Display: https://i.sstatic.net/Un3xo.png
Correct Image Display: https://i.sstatic.net/rBNzE.png
Is achieving this through CSS possible? If so, any hints or suggestions would be greatly appreciated.