HTML <colgroup> Tag
The colgroup tag designates a group of one or more columns in a table for formatting purposes. The tag specifies characteristics for columns included within the <colgroup>
tag.
This allows you to format or classify a column or set of columns rather than each individual cell. This tag is sometimes referred to as the <col> element.
Instead of repeating styles for each cell, for each row, the <colgroup>
tag is excellent for applying styles to whole columns.
The <colgroup>
tag must be a child of a table element, following any <caption> elements and preceding any <thead>, <tbody>, <tfoot>, and <tr> elements.
Use the <col> tag within the <colgroup> tag to define distinct characteristics for a column within a <colgroup>
.
Syntax
Attributes
Attribute | Value | Description |
---|---|---|
Span | number | Specifies how many columns a column group should span. |
Supported Browsers
Element | Chrome | Firefox | Safari | Edge / IE | Opera |
---|---|---|---|---|---|
<colgroup> | Yes | Yes | Yes | Yes | Yes |