表格布局

案例

<table cellpadding="0" cellspacing="0" width="400px" border="0">
      <tr>
        <td colspan="3" style="background-color: #ffa500">header</td>
      </tr>
      <tr>
        <td rowspan="2" style="background-color: red">sum</td>
        <td style="background-color: #ffd700; width: 200px">aside</td>
        <td style="height: 100px; width: 400px">section</td>
      </tr>
      <tr>
        <td colspan="2" style="background-color: #ffa500">footer</td>
      </tr>
      <tr>
        <td colspan="3" style="background-color: #eef500">footer</td>
      </tr>
</table>

 

 1.table标签属性

border
规定表格边框的宽度。
cellpadding
规定单元边沿与其内容之间的空白。
cellspacing
规定单元格之间的空白。

2.th td标签属性

colspan
规定单元格可横跨的列数。
rowspan
规定单元格可横跨的行数。

3.如果没有明确的表头 就尽量bu使用th

posted @ 2020-09-25 15:17  PiPai  阅读(171)  评论(0编辑  收藏  举报