表格中图像之间出现空白
我有以下 HTML:
<table width="700" align="center" style="border:0">
<tr style="border:0"> <td> <img src="images\1.png" /> </td></tr>
<tr style="border:0"> <td> <img src="images\2.png" /> </td> </tr>
<tr style="border:0"> <td> <img src="images\3.png" /></td> </tr>
<tr style="border:0"> <td> <img src="images\4.png" /> </td></tr>
<tr style="border:0"> <td> <img src="images\5.png" /> </td></tr>
<tr style="border:0"> <td> <img src="images\6.png" /> </td></tr>
</table>
问题是图像之间出现空白。我该如何删除它?
I have the following HTML:
<table width="700" align="center" style="border:0">
<tr style="border:0"> <td> <img src="images\1.png" /> </td></tr>
<tr style="border:0"> <td> <img src="images\2.png" /> </td> </tr>
<tr style="border:0"> <td> <img src="images\3.png" /></td> </tr>
<tr style="border:0"> <td> <img src="images\4.png" /> </td></tr>
<tr style="border:0"> <td> <img src="images\5.png" /> </td></tr>
<tr style="border:0"> <td> <img src="images\6.png" /> </td></tr>
</table>
The problem is that white space is appearing between the images. How do I remove it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(11)
首先将 cellspacing="0" cellpadding="0" 添加到表格元素
并删除 td 和 img 标签之间的空格
first add cellspacing="0" cellpadding="0" to your table element
and remove spaces between td and img tags
您可以尝试不使用表格,这样您就可以...
并使用一些CSS使它们成为没有边距/填充的块元素
,或者您可以像这样在表格上使用CSS...
您还需要添加一个您的表的几个属性
都试图摆脱表上的 padding.margin 。
但 IMO 对于你想要做的事情,使用 css 直接使用
标签路由会更好。
You could try not using a table, so you'd have ...
and use some css to make them block elements with no margin/padding
or you could use css on your table like this ...
you would also need to add a couple of attributes to your table
all trying to get rid of padding.margin on your table.
But IMO for what you're trying to do, going the straight
<img />
tag route with css would be better.应该解决它:)
should solve it :)
更改
至
,将cellspacing和cellpadding设置为0,然后检查
change
<td> <img src="images\1.png" /> </td></tr>
to<td><img src="images\1.png" /></td></tr>
, set cellspacing and cellpadding to 0, and check添加到您的风格
Add to your style
对于 Transitional Doctype,互联网上大多数建议的解决方案都有效。
但对于 Strict Doctype,以下内容将删除
中两个图像之间的白线:
想要在此处发布屏幕截图,但声誉不足,无法这样做。
For Transitional Doctype, most of the suggested solutions in the internet works.
But for Strict Doctype, the following will remove the white line between two images in
<TD>
:Want to post the screenshot here but insufficient reputation post to do so.
删除作为博客一部分的表格中图像之间出现的空白:
对于那些在博客上遇到此问题后来到这里的人。我遇到了同样的问题。然而,我的桌子是博客上的博客的一部分。我在表格的一个单元格中都有图像。我尝试了单元格间距、单元格填充和许多其他属性和参数,但没有任何效果。对于博客,在博客模板中进行了这些更改:
在“.post-body img”下,“padding: 10px”值更改为“padding: 0px”[这删除了图像之间的垂直空间]
在“.post-body”值下“行高:1.4;”更改为“行高:0;” [这删除了表格行之间的空间]
此处有更详细的答案:
http ://xomisse.com/blog/tutorial-remove-spaces- Between-images-in-blogger/
Removing white spaces appearing between images in a table which is part of the blog:
For those who came here after facing this problem on blogs. I faced same problem. However my table was part of a blog on blogger. I had images each in a cell of the table. I tried cellspacing, cellpadding and many other attributes and parameters but nothing worked. In case of blog, in the blog template these changes were made:
Under ".post-body img" value of "padding: 10px" changed to "padding: 0px" [This removed verticle space between images]
Under ".post-body" value of "line-height: 1.4;" changed to "line-height: 0;" [This removed space between table rows]
More detailed answer here:
http://xomisse.com/blog/tutorial-remove-spaces-between-images-in-blogger/
您如何归档数据?想到服务器了吗?
在某些文本编辑器中,您可以使用正则表达式进行搜索。然后您可以执行以下操作:
搜索:
替换:
搜索:
并将其替换为:
How are you archiving your data? Thought the server?
In some text editors you can make searches with regular expression. Then you can do this:
Search:
Replace:
Searches for:
And replaces it with:
尝试:
Try:
此外,某些移动浏览器可能会在没有宽度和高度属性的图像之间创建空白。将图像尺寸设置为 td 并将图像 w 100% h 100% 设置为。
Also some mobile browsers may create white spaces between images without width and height attribute. Set your images sizes to td and set your images w 100% h 100%.