<table border="1" width="400px" height="200px">
<caption>完整table</caption> //标题
<thead>
<tr>
<th>头</th>
<th>部</th>
</tr>
</thead>
<tbody>
<tr>
<td>身</td>
<td>体</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">底部</td> //横向合并
</tr>
</tfoot>
</table>
css样式:
- width height——仅table和td使用
- align水平对齐——table+tr+td
- valign垂直对齐——tr+td
- cellpadding cellspacing内外边距——table
注:thead/tbody/tfoot是不可见元素 无法给它们设置属性
细线表格:
table{ background-color: black; }
tr{ background-color: white; }
另外table加上 cellspacing='1'
若指定了 thead 和 tfoot,则其有默认高度 不随 table 设置高度改变
rowspan 和 colspan 只是向下和向后合并
去除表格间隙:
table {
border-collapse: collapse;
}