This <colgroup> element groups table columns together and allows the grouped columns to share properties and style settings.
<colgroup> |
Yes | Yes | Yes | Yes | Yes |
Some of the attributes in HTML 4.01 are not supported in HTML5.
The <colgroup> tag supports the Global Attributes in HTML.
The <colgroup> tag supports the Event Attributes in HTML.
colgroup { display: table-column-group; }
A demo showing how to use <colgroup>.
<html>
<body>
<table>
<colgroup span="2" style="color: blue;"></colgroup>
<colgroup style="color: red;"></colgroup>
<tr>
<td>col: 1, group: 1</td>
<td>col: 2, group: 1</td>
<td>col: 3, group: 2</td>
</tr>
<tr>
<td>col: 1, group: 1</td>
<td>col: 2, group: 1</td>
<td>col: 3, group: 2</td>
</tr>
<tr>
<td>col: 1, group: 1</td>
<td>col: 2, group: 1</td>
<td>col: 3, group: 2</td>
</tr>
</table>
</body><!--from w w w . j a v a 2s . c o m-->
</html>