I have an issue where 1x1 pixel is adding some extra space (way more than 1px in height) on the page. After doing some quick Googling, I have found that this is a common issue. My understanding is that tags are inline and thus interpreted as text.
- Extra spacing after an A Tag/img tag?
- Extra padding under an <img> tag?
- Image inside div has extra space below the image
My problem is that while I can replicate the fix on the live site--when I delete the tag or change its styling to display: block
, the excess space disappears--I cannot replicate the problem on a simplified HTML page. Even after I copied the exact code from link #3 into a new HTML document, I could not replicate the issue with the exact same code as in link 3.
I'd like to understand what exactly causes this problem before rolling out a production-level fix. Does anyone have any ideas about what factors exactly cause this?
EDIT: I'm attaching a screenshot of my implementation of the code from link #3.
EDIT2: I'm attaching another screenshot of the exact same JSFiddler code. So what is happening?
[mooved comment to question] My question is not about what is causing the issue. My question is why I see two different things in Chrome with the same code. I have attached two images to my question. In both images, you should see the same HTML markup and the same CSS. Yet Chrome is rendering them differently. My question is about what is causing this discrepancy.