无边框厚度的 CSS

发布于 2024-12-04 04:36:35 字数 411 浏览 6 评论 0原文

我有一张用 0px 边框构建的表格,我试图让每一行中的图像彼此无缝配合,但即使边框没有显示,仍然有一个 行之间有 1px 间隙。有办法解决这个问题吗?

table { 
    border-collapse: collapse;
    border-spacing: 0px;
    font-size: 10px;
}   

table th, table td { 
    padding: 0px;
    margin: 0px;
    border-width: 0px;
}  

tr { 
    padding: 0px;
    margin: 0px;
    border-collapse: collapse;
    border-spacing: 0px; 
}

I have a table that I built out with 0px border, and I am trying to get images in each row to fit seamlessly to one another but even though the border does not show there is still a 1px gap in between the rows. Is there a way to fix this?

table { 
    border-collapse: collapse;
    border-spacing: 0px;
    font-size: 10px;
}   

table th, table td { 
    padding: 0px;
    margin: 0px;
    border-width: 0px;
}  

tr { 
    padding: 0px;
    margin: 0px;
    border-collapse: collapse;
    border-spacing: 0px; 
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

空名 2024-12-11 04:36:35

可能是表格内的内容创建了一些额外的空间,并且您没有提到什么浏览器,但请注意 IE7 不支持边框折叠,因此您应该

<table cellspacing="0">

在 IE7 的表格中添加:。另外,没有理由对 tr 应用 border-collapse

Might be that the content inside the table is creating some extra space, and you didn't mention what browser, but be aware that IE7 doesn't understand border-collapse so you should add:

<table cellspacing="0">

to the table for IE7. Also, there is no reason to apply border-collapse to the tr.

浮生未歇 2024-12-11 04:36:35

我认为 border-spacing 适用于表格。您是否尝试过 border: none 作为 tr 元素?

I think border-spacing is for a table. Did you try border: none for the tr element?

糖粟与秋泊 2024-12-11 04:36:35

试试这个:

CSS

img {
   border:none;
   padding:0;
   margin:0;
}

HTML

<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
..table rows..
</table>

Try this:

CSS

img {
   border:none;
   padding:0;
   margin:0;
}

HTML

<table style="text-align: left; width: 100%;" border="0" cellpadding="0" cellspacing="0">
..table rows..
</table>
白衬杉格子梦 2024-12-11 04:36:35

您是否尝试过 display: block 来显示图像?

did you try display: block for images?

且行且努力 2024-12-11 04:36:35

感谢您的回复,我在 HTML 中设置了 cellspacing="0",并尝试了您的所有建议。似乎没有人改变结果,我现在唯一的想法是我正在 Mac 上工作,这是某种浏览器问题。我得在电脑上测试一下,看看效果如何。

Thanks for the responses, I had the cellspacing="0" in the HTML, and tried all your suggestions. None seemed to change the outcome, my only thought now is that I'm working on a Mac and that it is some kind of browser issue. I'll have to test it on a PC and see how it looks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文