White space at the bottom of the anchor

I have a tag surrounding the image. I have a border set to the div that the tag is in. I have both margin and padding equal to 0, but for some reason my tag is still 3 pixels above my image. This leaves a little space between the image and the border, which destroys the look I want to make.

What am I doing wrong? I tested in both FireFox and Chrome with the same results. Thanks

+44
html css xhtml
Jul 07 '10 at 18:11
source share
2 answers

The image is display: inline , so it is treated as a symbol and is on the baseline. This space is caused by the space provided for the descender (which you will find on letters such as j, g, y, and p).

Adjust vertical-align with CSS: img{vertical-align: bottom}

+76
Jul 07 '10 at 18:13
source share

display:block sufficient for this if the item does not have siblings.

+9
Jul 07 '10 at 18:20
source share



All Articles