定義和用法
<colgroup> 標籤用於對錶格中的列進行組合,以便對其進行格式化。
如需對全部列應用樣式,<colgroup> 標籤很有用,這樣就不需要對各個單元和各行重複應用樣式了。
<colgroup> 標籤只能在 table 元素中使用。
實例
兩個 colgroup 元素爲表格中的三列規定了不同的對齊方式和樣式(注意第一個 colgroup 元素橫跨兩列):
<table width="100%" border="1"> <colgroup span="2" align="left"></colgroup> <colgroup align="right" style="color:#0000FF;"></colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td>$53</td> </tr> </table>