Why in the following code the height of the div
is bigger than the height of the img
? There is a gap below the image, but it doesn't seems to be a padding/margin.
What is the gap or extra space below image?
#wrapper {
border: 1px solid red;
width:200px;
}
img {
width:200px;
}
<div id="wrapper">
<img src="http://i.imgur.com/RECDV24.jpg" />
</div>
All you have to do is assign this property:
The images by default have this property:
I used
line-height:0
and it works fine for me.You can use several methods for this issue like
Using
line-height
Using
display: flex
Using
display:
block
,table
,flex
andinherit
I found it works great using display:block; on the image and vertical-align:top; on the text.
or you can edit the code a JS FIDDLE
I just added
float:left
to div and it workedAnother option suggested here is setting the style of the image as
style="display: block;"