且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

< IMG>在< table>中没有任何空格

更新时间:2023-02-23 14:01:10

img s是内联元素。图像之间的水平空间来自HTML中图像之间的空白。字符此处之间存在空格的原因相同。

imgs are inline elements. The horizontal space between the images is coming from the whitespace between the images in the HTML. The same reason that there's a space between the characters here.

所以,要解决这个问题,请删除空格: http://jsfiddle.net/xMW7N/2/

So, to fix that, remove the whitespace: http://jsfiddle.net/xMW7N/2/

垂直空间也是因为图像是内联元素。差距是为下划线保留的空间,如 g j

The vertical space is also because the images are inline elements. The gap is the space reserved for descenders in letters like g and j.

要解决此问题,请在 img 上设置 vertical-align:top http://jsfiddle.net/xMW7N/3/

To fix that, set vertical-align: top on img: http://jsfiddle.net/xMW7N/3/

虽然在你的情况下(如你的问题所述),设置 float:left 可以正常工作: http://jsfiddle.net/xMW7N/4/

Although in your case (as mentioned in your question), setting float: left works just fine: http://jsfiddle.net/xMW7N/4/

这是因为 float:left 强制显示:阻止,因此解决了内联图像导致的所有问题。

That works because float: left forces display: block, so all of the problems caused by the images being inline are resolved.