Html 删除表格行之间的空间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18920005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 13:37:24  来源:igfitidea点击:

Remove space between table row

htmlcsshtml-tablerowhtml-email

提问by Matt Jones

I'm building an html email template and need to remove the spacing between table rows, but need to keep the cellspacing at 10px. You will see in the example blue title bars and the spacing beneath them. Is there any way to isolate those table rows using CSS and remove this?

我正在构建一个 html 电子邮件模板,需要删除表格行之间的间距,但需要将单元格间距保持在 10 像素。您将在示例中看到蓝色标题栏及其下方的间距。有没有办法使用 CSS 隔离这些表格行并删除它?

HTML: http://www.tailwatersflyfishing.com/email/template/new.html

HTML:http: //www.tailwatersflyfishing.com/email/template/new.html

回答by Chad

First of all, semantically, tables should not be used for layout-- they should be used to display tabular data... Secondly, a fix (it's not a great fix, but it works) is to essentially disable table functionality:

首先,从语义上讲,表格不应该用于布局——它们应该用于显示表格数据......其次,修复(这不是一个很好的修复,但它有效)是从本质上禁用表格功能:

table, tbody, tr {
    display: block;
}

Look into switching your headlines to h2 tags or something-- maybe an element that is actually semantically created to do what you're trying to do.

考虑将您的标题切换为 h2 标签或其他东西——也许是一个实际上在语义上创建的元素来做你想做的事情。

回答by kevinius

Try adding a new attribuut (cellspacing) to the table holding the blue title

尝试向带有蓝色标题的表格添加新的属性(单元格间距)

<table width="670" cellpadding="0" border="0" align="center" cellspacing="0">

Is it possible you are confusing cellpadding and padding with cellspacing, since i can't see any cellspacing attribuut to the table tags...

您是否有可能将 cellpadding 和 padding 与 cellpacing 混淆,因为我看不到 table 标签的任何 cellpacing 属性...

回答by Yassine Yassoni

You should not use CSS call beacause mailer doesn't accept them (Lotus, Outllok 2007, ...)

你不应该使用 CSS call 因为邮件程序不接受它们(Lotus,Outllok 2007,...)

For spaces you can use a spacer image (a 1x1 px transparent gif) to get them looks right

对于空间,您可以使用间隔图像(1x1 像素透明 gif)使它们看起来正确

the font-style:0 correct a blank space in hotmail on Firefox render.

font-style:0 在 Firefox 渲染上更正 hotmail 中的空白区域。

You need also to put a display:block for all your image and specify a height and width for both the image and the TD where it apears.

您还需要为所有图像放置一个 display:block 并为图像和它出现的 TD 指定高度和宽度。