I have a div with an image tag inside, and the div height appears to be a little larger than the image.
I could fix this problem by setting a specific height for the div (the same as the image), but I'm working with a responsive layout, and I don't want to set a specific height for the div, so that when the browser window scales (for example in mobile devices) the div will scale and maintain the ratio.
I need that the div height to be exactly as the image height.
This is the scenario:
<div class='box'><img src='image.jpg'></div>
Css is:
img {
height: auto;
max-width: 100%;
width: auto;
}
Does anybody know how to fix this problem?