CSS:如何在表中的行之间创建间距? [英] CSS: how do I create a gap between rows in a table?

查看:143
本文介绍了CSS:如何在表中的行之间创建间距?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

意味着使结果表看起来不像这样:

Meaning making the resultant table look less like this:


[===ROW===]
[===ROW===]
[===ROW===]
[===ROW===]

...等等:


[===ROW===]

[===ROW===]

[===ROW===]

[===ROW===]

我尝试添加

margin-bottom:1em;



没有。任何想法?

to both td and tr but got nothing. Any ideas?

推荐答案

table {
    border-collapse: collapse;
}

td {
    padding-top: .5em;
    padding-bottom: .5em;
}

单元格不会对任何内容作出反应,除非您先设置边框合拢。你还可以为TR元素添加边框(除了别的以外)。

The cells won't react to anything unless you set the border-collapse first. You can also add borders to TR elements once that's set (among other things.)

如果这是布局,我会移动到使用DIV和更多的-date布局技术,但如果这是表格数据,自己敲掉。我仍然在我的Web应用程序中大量使用表来获取数据。

If this is for layout, I'd move to using DIVs and more up-to-date layout techniques, but if this is tabular data, knock yourself out. I still make heavy use of tables in my web applications for data.

这篇关于CSS:如何在表中的行之间创建间距?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆