If you try to put an image inside a <div> element that has borders, you will see an extra white space (around 3px) at the bottom of image. It happens because image is an inline-level element so browser adds some whitespace under the baseline to adjust other inline elements.
The easiest way to get rid of this problem is to change the default display value of the image from inline to block, i.e. apply the style display: block; on images, as shown below:
Use the CSS
displaypropertyIf you try to put an image inside a
<div>element that has borders, you will see an extra white space (around 3px) at the bottom of image. It happens because image is an inline-level element so browser adds some whitespace under the baseline to adjust other inline elements.The easiest way to get rid of this problem is to change the default
need an explanation for this answer? contact us directly to get an explanation for this answerdisplayvalue of the image from inline to block, i.e. apply the styledisplay: block;on images, as shown below: