Column group. The HTML tag <colgroup> specifies attributes to be applied to a set of table columns. Often used with col elements.
Must be used as a child of a <table> element, after any <caption> elements and before any <thead>, <tbody>, <tfoot>, and <tr> elements.
If you need to apply different properties to a column within a <colgroup>, you can use the HTML col tag within the colgroup tag.
Required Attributes
Optional Attributes
- span can be used to specify the number of columns the colgroup element applies to.
- align can be used to horizontally align the cells within the column group. The value can be left, center, right, justify or char.
- valign can be used to vertically align the cells within the column group. The value can be top, middle, bottom or baseline.
- char can be used to specify a character with which cells will align, such as a decimal point. It is not supported by any major browser.
- charoff can be used to specify the number of pixels the alignment should be offset from the char character. It is not supported by any major browser.
- Common attributes
Example
<table>
<colgroup>
<col class="column1" />
<col class="column2" />
<col class="columns3and4" span="2" />
</colgroup>
<tr>
<th>lion</th>
<th>meerkat</th>
<th>warthog</th>
<th>baboon</th>
</tr>
<tr>
<td>Simba</td>
<td>Timon</td>
<td>Pumba</td>
<td>Rafiki</td>
</tr>
</table>
Changes in HTML5
Related Tags