Is it possible to maintain the aspect ratio of an image based on the height when it is centered in a flex container like so:
<div class="fillerRow" style="flex: 80%">
<div class="fillerBox"></div>
<img id="centerImg" src="./img/image.png"></img>
<div class="fillerBox"></div>
</div>
.fillerRow {
display: flex;
flex-direction: row;
width: 100%;
flex: 1;
}
.fillerBox {
flex: 1;
}
#centerIImg {
height: 100%;
flex: auto;
width: auto;
}
The idea here is that the image scales based on the screen height while maintaining its aspect ratio. The two fillerBox divs surrounding the image should adjust their own width while respecting the image in the center.
How is this possible?