I have a 48x48 div and inside it there is an img element, I want to fit it into the div without losing any part, in the mean time the ratio is kept, is it achievable using h
Unfortunately max-width + max-height do not fully cover my task... So I have found another solution:
To save the Image ratio while scaling you also can use object-fit
CSS3 propperty.
Useful article: Control image aspect ratios with CSS3
img {
width: 100%; /* or any custom size */
height: 100%;
object-fit: contain;
}
Bad news: IE not supported (Can I Use)