The HTML <colgroup></colgroup> element defines a group of columns within a <table> element. The start tag may be omitted, if it has a <col /> element as its first child and if it is not preceded by a <colgroup> whose end tag has been omitted. The end tag may be omitted, if it is not followed by a space or a comment.
Attributes
| Attribute | Value | Description |
|---|---|---|
bgcolor |
color | This non-standard attribute defines the background color of each cell within the column group. A valid color name or color code is used as the value. |
span |
positive integer | This attribute contains a positive integer indicating the number of additional consecutive columns to apply the attributes of the <col /> element. If not present, its default value is 0.
|
- Global Attributes
HTML example:
<table border="1" width="400"> <colgroup> <col align="center" width="150" /> <col align="right" /> </colgroup> <td>This column is aligned to the center.</td> <td>This one is aligned to the right.</td> <tr> <td>!</td> <td>?</td> </tr> <tr> <td>!</td> <td>?</td> </tr> </table>