HTML Table 表格

一、table表格语法与结构

<table> 
    <tr> 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
        <td>&nbsp;</td> 
    </tr> 
</table> 

<table> 
    <tr> 
        <th>&nbsp;</th> 
        <th>&nbsp;</th> 
        <th>&nbsp;</th> 
    </tr> 
</table> 

以上2个表格结构中td和th使用,没有区别均可使用。

 

二、table标签使用说明

我们学习DIV+CSS了,不是就完全放弃丢弃table表格布局。想想我们为什么学习DIV CSS其中一个因素,让布局更简单、代码更简单,所以有时候

我们也需要table表格来布局。比如,电子表格型的数据表格。

 

三、Table tr td th表格使用实例

<table width="300" border="1" cellspacing="0"> 
    <tr> 
        <th>班级</th> 
        <th>日期</th> 
        <th>标题</th> 
    </tr> 
    <tr> 
        <td>一班</td> 
        <td>2012-5-10</td> 
        <td>标题1</td> 
    </tr> 
    <tr> 
        <td>二班</td> 
        <td>2012-5-20</td> 
        <td>标题2</td> 
    </tr> 
</table> 

在线运行

 

四、table表格总结

  1. 表格可以在DW输入,拖拽调整
  2. table表格实用于多列数据列表
  3. 学习了DIV CSS还得学习TABLE
  4. table会使用灵活运用即可
  5. 多列数据列表table标签要比使用div css节约代码,任意控制内容排版