tags:

views:

1293

answers:

3

I have two anchored images on top of each other, separated with a line break. I want the images to sit directly on top of each other, but in Firefox there is a gap between the images. It works in IE7. The only way I have been able to fix this is by changing the line-height (which I don't want to do).

<a href="image.jpg">
    <img height="75" width="75" src="image.jpg" />
</a>
<br/>
<a href="image2.jpg">
    <img height="75" width="75" src="image2.jpg" />
</a>
+3  A: 

Placing the CSS property vertical-align to bottom on the top image will remove the gap in Firefox.

matth1jd
Turns out that using bottom, middle, or top works. Thanks.
Chris B
Glad I could help -- oddly enough it trips me up for a couple of minutes every time.
matth1jd
Edit: bottom, middle, or top works as long as it's applied to ALL of the images. I wish you could edit comments on SO :)
Chris B
A: 
Noctrine
Using a <br /> to indicate a line break is absolutely not a bad practice. Using multiple <br />s instead of a single paragraph <p> is, however.If this is a list of images, you should indeed store them in a list (<ul> or <ol>) with display: none on the list items (<li>).
Ronald
Set those list items (<li>) to display: block, of course!
Ronald
A: 

Perhaps setting the images to display:block would work. As an image is by default inline with the text, it leaves space at the bottom for descendenders (such as j,g,and y), even though an image will never have any. Many browsers account for this, but doing so is non-standard. Setting them to block should remove this annoyance in all browsers.

Eric