Question

When I have an image from 950x500 and output it like so:

<img src="http://full/url/to/image.png" />

There is a weird 3px in height space below the image. When asking javascript about it, it will indeed say the size is 950x503. While the image is really (check multiple times) 500 in size. It appears that the image tag does this how can this be fixed?

Note that the image must also remain to function dynamic. So if I were to set width of the image to 100% the height will resize accordingly.

Was it helpful?

Solution 2

Never mind, the answer is, set your image display on block like so:

img { display: block; }

OTHER TIPS

Try this instead of putting display :block; beacuse this gonaa effect all the image tag though there is no harm, but the right way is this :

<img src="http://full/url/to/image.png" height="950" width="500"/>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top