.box {
width : 100%;
max-height : 300px;
overflow : hidden;
}
img {
width : 100%;
}
<div class="box">
<img src="banner.png" />
</div>
I am faced with a challenge regarding the sizing of the image banner.png within the .box
element. I want to restrict the height using the max-height
property. In case the height of banner.png exceeds this limit, I need to ensure that the img tag is vertically aligned in the middle.
Has anyone encountered a similar issue and found a solution?