HTML <colgroup> 标签
html <colgroup> 用于对表格中的列进行组合,以便对其进行格式化
使用 <colgroup> 可以向整个列应用样式,而不需要重复为每个单元格或每一行设置样式
只能在 <table> 元素之内,在任何 <caption> 元素之后,在任何 <thead>、<tbody>、<tfoot>、<tr> 元素之前使用 <colgroup>
如果想对 <colgroup> 中的某列定义不同的,可以在 <colgroup> 内使用 <col>
范例
<colgroup> 和 >col> 为表格中的三个列设置了背景色
<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>