HTML <colgroup> Tag
Description:
The <colgroup> tag is used to group columns in a table for formatting.
The <colgroup> tag is useful for applying styles to entire columns, instead of repeating the styles for each cell, for each row.
The <colgroup> tag can only be used inside a table element.
Specific Attributes:
| Attribute | Definition |
| span | Specifies how many columns to span. |
| width | Width of the column. |
Other Attributes:
| Attribute | Definition |
| dir |
Specifies the text direction for the content in
an element.
|
| class | Specifies a classname for an element. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| style | Specifies an inline style for an element. |
| align | Specifies the alignment of the content related to a col element. |
| valign | Specifies the vertical alignment of the content related to a col element. |
| char | Specifies the alignment of the content related to a col element to a character. |
| charoff | Specifies the number of characters the content will be aligned from the character specified by the char attribute. |
Example Code:
<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>
Result
| ISBN | Title | Price |
|---|---|---|
| 3476896 | My first HTML | $53 |