【发布时间】:2013-08-23 20:08:55
【问题描述】:
我想在 HTML 表格页眉和页脚以及我的正文内容之间留一点空间。我虽然 margin-top 和 margin-bottom 会这样做,但事实并非如此。然而字体粗细:粗体;指令被考虑在内。
我的 HTML:
<table id="myTbl">
<thead>
<tr>
<th>My Table Header</th>
</tr>
</thead>
<tbody>
<tr>
<td>My Body Content</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>My Table Footer</th>
</tr>
</tfoot>
</table>
我的 CSS:
#myTbl {
font-weight: normal;
}
#myTbl thead {
font-weight: bold;
margin-bottom: 10px;
}
#myTbl tfoot {
font-weight: bold;
margin-top: 10px;
}
JSFiddle 可用here。我正在使用 Chrome。
【问题讨论】:
-
保证金不适用于内部
<table>元素 - w3.org/TR/CSS2/box.html#margin-properties
标签: html css html-table footer