Reputation: 2498
I have a simple HTML document, it contains a div and a img element. There is an extra space after img element.
Snippet is in below.
I tried it in Chrome and Firefox.
How can remove extra space after image element? I want to make div element height same with image.
Thanks.
<div style="background-color:green">
<img src="https://cdn.cvmer.com/rapor/bg/E5402F.png" />
</div>
Upvotes: 0
Views: 165
Reputation: 5401
Make the img
a block element.
img {
display: block;
}
<div style="background-color:green">
<img src="https://cdn.cvmer.com/rapor/bg/E5402F.png" />
</div>
Upvotes: 3
Reputation: 938
You just need to add this CSS
img {
display: block;
}
<div style="background-color:green">
<img src="https://cdn.cvmer.com/rapor/bg/E5402F.png" />
</div>
Upvotes: 3