【问题标题】:Reducing the default spacing between html tr tags减少 html tr 标签之间的默认间距
【发布时间】:2013-03-30 02:05:14
【问题描述】:

如何减少<tr> 表格标签之间的间距?我想低于 0 的单元格间距。换句话说,我希望行几乎相互接触。

我有:

<table class="table">
  <tr class="row"><td>One</td></tr>
  <tr><td>Two</td></tr>
</table>

我尝试过类似于以下的 CSS:

.table{ font-size: 12px; padding: 0;  margin:0;    }
.row{    height: 30px    }  / *tried playing with this to no avail */

没有成功 - 表格行没有比默认值更接近。

【问题讨论】:

    标签: html css html-table


    【解决方案1】:
    .table{
        border-collapse:collapse;
    } 
    
    .table tr td{
         height: 30px;
         padding: 0;
    }
    

    不确定标准,但我注意到只有我用于 TD 的规则才有效,TR 无效!

    【讨论】: