table标签的结构与合并单元格的实现方法
1.<table>标签的结构
示例代码:
一个完整的例子:
2.合并上下的单元格(rowspan)
示例代码:
3.合并左右的单元格(colspan)
示例代码:
示例代码:
代码如下:
<table border="1"> <caption>信息统计表</caption> <thead> <tr > <th>#</th> </tr> </thead> <tbody> <tr> <td>1</td> </tr> <tr> <td>2</td> </tr> <tr> <td>3</td> </tr> <tr> <td>4</td> </tr> </tbody> </table>
一个完整的例子:
代码如下:
<table border="1"> <caption class="text-center">信息统计表</caption> <thead> <tr > <th>#</th> <th>Firstname</th> <th>Lastname</th> <th>Phone</th> <th>QQ</th> </tr> </thead> <tbody> <tr class="error"> <td>1</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> <tr class="warning"> <td>2</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> <tr class="info"> <td>3</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> <tr class="success"> <td>4</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> </tbody> </table>
2.合并上下的单元格(rowspan)
示例代码:
代码如下:
<table border="1"> <caption class="text-center">信息统计表</caption> <thead> <tr > <th>#</th> <th>Firstname</th> <th>Lastname</th> <th>Phone</th> <th>QQ</th> </tr> </thead> <tbody> <tr class="error"> <td rowspan="2">1</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> <tr class="warning"> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> <tr class="info"> <td>3</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> <tr class="success"> <td>4</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> </tbody> </table>
3.合并左右的单元格(colspan)
示例代码:
代码如下:
<table class="table table-condensed table-bordered"> <caption class="text-center">信息统计表</caption> <thead> <tr > <th>#</th> <th>Firstname</th> <th>Lastname</th> <th>Phone</th> <th>QQ</th> </tr> </thead> <tbody> <tr class="error"> <td>1</td> <td colspan="4"><p class="text-center">这是合并了四个单元格</p></td> </tr> <tr class="warning"> <td>2</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> <tr class="info"> <td>3</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> <tr class="success"> <td>4</td> <td>qian</td> <td>shou</td> <td>11111111111</td> <td>111111111</td> </tr> </tbody> </table>
相关推荐
momode 2020-09-11
思君夜未眠 2020-09-04
行吟阁 2020-08-09
表格的现在还是较为常用的一种标签,但不是用来布局,常见处理、显示表格式数据。在HTML网页中,要想创建表格,就需要使用表格相关的标签。<table> <tr> <td>单元格内的文字</td> ...
gufudhn 2020-08-09
世樹 2020-11-11
SCNUHB 2020-11-10
bleach00 2020-11-10
FellowYourHeart 2020-10-05
jessieHJ 2020-08-19
末点 2020-08-03
nimeijian 2020-07-30
好记忆也需烂 2020-07-28
zlsdmx 2020-07-05
tomson 2020-07-05
tianqi 2020-07-05
onlykg 2020-07-04