1.<table>标签的结构
示例代码:
复制代码 代码如下:
&nbsp;<table border="1">
&nbsp; &nbsp; &nbsp; <caption>信息统计表</caption>
&nbsp; &nbsp; &nbsp;  <thead>
&nbsp; &nbsp; &nbsp;  <tr >
&nbsp; &nbsp; &nbsp;  <th>#</th>
&nbsp; &nbsp; &nbsp;  </tr>
&nbsp; &nbsp; &nbsp; </thead>
&nbsp; &nbsp; &nbsp; <tbody>
&nbsp; &nbsp; &nbsp;  <tr>
&nbsp; &nbsp; &nbsp;  <td>1</td>
&nbsp; &nbsp; &nbsp;  </tr>
&nbsp; &nbsp; &nbsp;  <tr>
&nbsp; &nbsp; &nbsp;  <td>2</td>
&nbsp; &nbsp; &nbsp;  </tr>
&nbsp; &nbsp; &nbsp;  <tr>
&nbsp; &nbsp; &nbsp;  <td>3</td>
&nbsp; &nbsp; &nbsp;  </tr>
&nbsp; &nbsp; &nbsp;  <tr>
&nbsp; &nbsp; &nbsp;  <td>4</td>
&nbsp; &nbsp; &nbsp;  </tr>
&nbsp; &nbsp; &nbsp; </tbody>
</table>

一个完整的例子:
复制代码 代码如下:
&nbsp;<table border="1">
&nbsp; &nbsp; &nbsp; <caption class="text-center">信息统计表</caption>
&nbsp; &nbsp; &nbsp; <thead>
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp;<tr >
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp;<th>#</th>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp;<th>Firstname</th>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp;<th>Lastname</th>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp;<th>Phone</th>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp; &nbsp;<th>QQ</th>
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp;</tr>
&nbsp; &nbsp; &nbsp; </thead>
&nbsp; &nbsp; &nbsp; <tbody>
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;<tr class="error">
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>1</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>qian</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>shou</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>11111111111</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>111111111</td>
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;</tr>
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;<tr class="warning">
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>2</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>qian</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>shou</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>11111111111</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>111111111</td>
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;</tr>&nbsp;
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;<tr class="info"> <td>3</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>qian</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>shou</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>11111111111</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>111111111</td>
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;</tr>&nbsp;
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;<tr class="success">
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;  &nbsp;<td>4</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>qian</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>shou</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>11111111111</td>
&nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;<td>111111111</td>
&nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;</tr>&nbsp;
&nbsp; &nbsp; &nbsp; </tbody>
</table>

table标签的结构与合并单元格的实现方法

2.合并上下的单元格(rowspan)
示例代码:
复制代码 代码如下:
<table border="1">
&nbsp; &nbsp; &nbsp; <caption class="text-center">信息统计表</caption>
&nbsp; &nbsp; &nbsp;  <thead>
&nbsp; &nbsp; &nbsp;   <tr >
&nbsp; &nbsp; &nbsp;   <th>#</th>
&nbsp; &nbsp; &nbsp;   <th>Firstname</th>
&nbsp; &nbsp; &nbsp;   <th>Lastname</th>
&nbsp; &nbsp; &nbsp;   <th>Phone</th>
&nbsp; &nbsp; &nbsp;   <th>QQ</th>
&nbsp; &nbsp; &nbsp;   </tr>
&nbsp; &nbsp; &nbsp;  </thead>
&nbsp; &nbsp; &nbsp; <tbody>
&nbsp; &nbsp; &nbsp;  <tr class="error">
&nbsp; &nbsp; &nbsp;  <td rowspan="2">1</td>
&nbsp; &nbsp; &nbsp;  <td>qian</td>
&nbsp; &nbsp; &nbsp;  <td>shou</td>
&nbsp; &nbsp; &nbsp;  <td>11111111111</td>
&nbsp; &nbsp; &nbsp;  <td>111111111</td>
&nbsp; &nbsp; &nbsp;  </tr> <tr class="warning">
&nbsp; &nbsp; &nbsp;  <td>qian</td>
&nbsp; &nbsp; &nbsp;  <td>shou</td>
&nbsp; &nbsp; &nbsp;  <td>11111111111</td>
&nbsp; &nbsp; &nbsp;  <td>111111111</td>
&nbsp; &nbsp; &nbsp;  </tr> <tr class="info"> <td>3</td>
&nbsp; &nbsp; &nbsp;  <td>qian</td>
&nbsp; &nbsp; &nbsp;  <td>shou</td>
&nbsp; &nbsp; &nbsp;  <td>11111111111</td>
&nbsp; &nbsp; &nbsp;  <td>111111111</td>
&nbsp; &nbsp; &nbsp;  </tr> <tr class="success"> <td>4</td>
&nbsp; &nbsp; &nbsp;  <td>qian</td>
&nbsp; &nbsp; &nbsp;  <td>shou</td>
&nbsp; &nbsp; &nbsp;  <td>11111111111</td>
&nbsp; &nbsp; &nbsp;  <td>111111111</td>
&nbsp; &nbsp; &nbsp;  </tr>&nbsp;
&nbsp; &nbsp; &nbsp; </tbody>
</table>

table标签的结构与合并单元格的实现方法

3.合并左右的单元格(colspan)
示例代码:
复制代码 代码如下:
<table class="table table-condensed table-bordered">
&nbsp; <caption class="text-center">信息统计表</caption>
&nbsp; &nbsp; <thead>
&nbsp; &nbsp; &nbsp; <tr >
&nbsp; &nbsp; &nbsp; <th>#</th>
&nbsp; &nbsp; &nbsp; <th>Firstname</th>
&nbsp; &nbsp; &nbsp; <th>Lastname</th>
&nbsp; &nbsp; &nbsp; <th>Phone</th>
&nbsp; &nbsp; &nbsp; <th>QQ</th>
&nbsp; &nbsp; &nbsp; </tr>
&nbsp; &nbsp; </thead>
&nbsp; <tbody>
&nbsp; &nbsp; <tr class="error">
&nbsp; &nbsp; <td>1</td>
&nbsp; &nbsp; <td colspan="4"><p class="text-center">这是合并了四个单元格</p></td>
&nbsp; &nbsp; </tr>
&nbsp; &nbsp; <tr class="warning">
&nbsp; &nbsp; <td>2</td>
&nbsp; &nbsp; <td>qian</td>
&nbsp; &nbsp; <td>shou</td>
&nbsp; &nbsp; <td>11111111111</td>
&nbsp; &nbsp; <td>111111111</td>
&nbsp; &nbsp; </tr>
&nbsp; &nbsp; <tr class="info">
&nbsp; &nbsp; <td>3</td>
&nbsp; &nbsp; <td>qian</td>
&nbsp; &nbsp; <td>shou</td>
&nbsp; &nbsp; <td>11111111111</td>
&nbsp; &nbsp; <td>111111111</td>
&nbsp; &nbsp; </tr>
&nbsp; &nbsp; <tr class="success">
&nbsp; &nbsp; <td>4</td>
&nbsp; &nbsp; <td>qian</td>
&nbsp; &nbsp; <td>shou</td>
&nbsp; &nbsp; <td>11111111111</td>
&nbsp; &nbsp; <td>111111111</td>
&nbsp; &nbsp; </tr>
&nbsp; </tbody>
</table>

table标签的结构与合并单元格的实现方法
标签:
table标签,合并单元格

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com