Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8740001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:03:12+00:00 2026-06-13T11:03:12+00:00

If a <div> or any other element follows an <img> , then a ~3px

  • 0

If a <div> or any other element follows an <img>, then a ~3px whitespace appears in between them — even if margins are zero’d.

<img src="example-fractal-art.png">
<div>What is with that gap?<div>

Here’s what it looks like with some CSS.

enter image description here

Now it’s pretty easy to throw in display: block into the CSS and solve the problem. But why is it there? There are no computed margins, padding, borders, or anything like that.

What are the browsers doing? Someone even called it “magic”.

P.S. Alternatively, in some cases, it is possible to solve this by removing whitespace in the HTML code. (But that doesn’t work in this case, why?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:03:13+00:00Added an answer on June 13, 2026 at 11:03 am

    The img is a “replaced element” in HTML, and as such, is it treated as a character. Now in the absence of any styles, the image is aligned with the baseline of the other characters on the line.

    So in other words, there is room for the descender underneath the image.

    enter image description here

    Changing it to a block removes this feature, as you noticed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say that I have an element inside a div (or any other containing element,
I have a div or any other element. I need to keep some parameter
Without using any other jquery plugin I'm looking to continuously flash/change a div's border
When using namespaces in CSS, you can select, for example, any div element in
If any of the nested div s below have a length longer then an
Is there any method to rename a div element. I have a div with
I'd like to overlay a div (or any element that'll work) over a table
I would like to hide all other element except class=imagebrowser in following, <div class=entry>
I have an element as follows <div id=loadNavigation style=width:20%></div> <div id=loadContent style=width:80%></div> Essentially navigation
I want to put a radio button (or any other element) on the left

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.