數據分析,一般都需要顯示數據,就需要使用html做復雜的表格。復雜表格一般是對td的rowspan 、colspan屬性值。
在html中<td> 標簽定義 HTML 表格中的標准單元格。
(1)rowspan 屬性規定單元格可橫跨的行數;
(2)colspan 屬性規定單元格可橫跨的列數。
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 2 <html> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 5 <title>復雜表格</title> 6 </head> 7 <body> 8 <center> 9 <table width = "20%" border="1"> 10 <tr> 11 <th>網站</th> 12 <th colspan="2">統計情況</th> <!-- colspan="2" 占位,表示這一列占2列 --> 13 </tr> 14 <tr> 15 <td rowspan="3">奇虎360</td> <!-- rowspan="2" 占位,表示這一列占3行 --> 16 <td>http://hao.360.cn/</td> 17 <td>11</td> 18 </tr> 19 <tr> 20 <td>http://sh.qihoo.com/</td> 21 <td>22</td> 22 </tr> 23 <tr> 24 <td>http://video.so.com/</td> 25 <td>33</td> 26 </tr> 27 </table> 28 </center> 29 </body> 30 </html>
顯示:
rowspan 、colspan 可以理解為占位。占行數、列數。