html <colgroup> 標(biāo)簽用于對(duì)表格中的列進(jìn)行組合,以便對(duì)其進(jìn)行格式化 使用 <colgroup> 標(biāo)簽可以向整個(gè)列應(yīng)用樣式,而不需要重復(fù)為每個(gè)單元格或每一行設(shè)置樣式 只能在 <table> 元素之內(nèi),在任何一個(gè) <caption> 元素之后,在任何一個(gè) <thead>、<tbody>、<tfoot>、<tr> 元素之前使用 <colgroup> 標(biāo)簽 如果想對(duì) <colgroup> 中的某列定義不同的屬性,可以在 <colgroup> 標(biāo)簽內(nèi)使用 <col> 標(biāo)簽 屬性
范例<colgroup> 和 >col> 標(biāo)簽為表格中的三個(gè)列設(shè)置了背景色 <table border="1"> <colgroup> <col span="2" style="background-color:red"> <col style="background-color:yellow"> </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> |