White space at bottom of anchor tag
I have an tag surrounding an image. I have a border set on the div that the tag is in. I have both margin and padding set to 0 but for some reason my tag is still about 3 pixels taller than my image. This leaves a bit of space between the image and the border, which destroys the look that I want to accomplish.
What am I doing wrong? I have tested in both FireFox and Chrome with the same results. Thanks
The image is display: inline
so it is treated like a character and sits on the baseline. The gap is caused by the space provided for the descender (which you find on letters like j, g, y and p).
Adjust the vertical-align
with CSS: img{vertical-align: bottom}
如果元素没有兄弟, display:block
就足够了。
上一篇: 这两个元素(<li>)之间的这个随机额外空间是什么?
下一篇: 锚标签底部的白色空间