I have the code bellow.
My issue is when the image is bigger than the parent height, it shrinks by height but not by width also.
I want the image to scale, and keep his ratio. For example the 150x150 and 100X100 images are not square.
.container{
margin: 0;
position: relative;
overflow: hidden;
border: 1px solid green;
}
.items {
left: 0;
top: 0;
display: flex;
flex-direction: row;
padding: 0.5rem 0;
position: relative;
margin: 2px;
}
.item {
align-items: center;
display: flex;
height: 60px;
justify-content: center;
margin: 2px;
}
.item > * {
cursor: pointer;
display: flex;
max-height: 100%; }
.item img {
display: block;
max-height: 100%; }
<div class="container">
<div class="items">
<div class="item" >
<a href="#"><img src="https://via.placeholder.com/150">
</a>
</div>
<div class="item" >
<a href=""><img src="https://via.placeholder.com/100">
</a>
</div>
<div class="item" >
<a href=""><img src="https://via.placeholder.com/100">
</a>
</div>
<div class="item" >
<a href=""><img src="https://via.placeholder.com/50">
</a>
</div>
</div>
</div>