锚定标记底部的空白区域 [英] White space at bottom of anchor tag
问题描述
我有一个围绕图片的标记。我有一个边框设置在div的标签是。我有两个边距和padding设置为0,但由于某种原因,我的标签仍然比我的图像高约3像素。这会在图像和边框之间留下一点空间,这会破坏我要完成的外观。
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.
我做错了什么?我已经测试了在FireFox和Chrome相同的结果。
感谢
What am I doing wrong? I have tested in both FireFox and Chrome with the same results. Thanks
推荐答案
图片是 display:inline
它被视为一个字符并坐在基线上。间隙是由为下降器提供的空间引起的(您在字母上找到j,g,y和p)。
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).
调整 vertical-align
with CSS: img {vertical-align:bottom}
Adjust the vertical-align
with CSS: img{vertical-align: bottom}
这篇关于锚定标记底部的空白区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!