I'm struggling with resizing an image within a div using the em
size unit. I want the image to be half the size of its parent div, so I set both the width and height CSS properties of the image to 0.5em
.
However, when looking at the code below, you can see that the result is not what I expected!
<div>
<img src=''>
</div>
html {
font-size:16px;
}
div {
width: 20em;
height: 20em;
border: 1px solid red;
}
img {
border: 1px solid green;
width: 0.5em;
height: 0.5em;
}
Fiddle: http://jsfiddle.net/framj00/pz27X/1/
Could someone please assist me in resolving this issue?