The <colgroup> element defines a group of columns in a <table>. Use it to style or size several columns together.
Two valid patterns: set span on <colgroup> with no<col> children, or omit span and nest one or more <col> elements. Place <colgroup> after any <caption> and before <thead>, tbody, tfoot, or tr.
Baseline · Widely available.
Not deprecated as an element. Stable across browsers since about July 2015 (and earlier in practice). Some CSS effects on column groups have limits.
Deprecated attributes.
Do not use align, bgcolor, char, charoff, valign, or width on <colgroup>. Use CSS instead.
Syntax
HTML Syntax
syntax.html
<colgroup span="n"></colgroup>
Or nest columns: <colgroup><col>…</colgroup> with no span on the group. Keep both start and end tags in study examples for clarity.
Reference
Attributes
Modern and legacy attributes you may see on <colgroup>:
One colgroup hosts all col definitions (no group-level span).
Period column gets its own col.
Morning hours share span="3"; afternoon hours share another span="3".
1 + 3 + 3 = 7 matches seven cells per row.
Edge Cases & Pitfalls
Most colgroup bugs mix span with col, wrong order, or covered backgrounds.
rules
span XOR nested col
Never combine span on colgroup with <col> children. Choose one pattern.
order
After caption, before rows
Invalid placement (for example after thead) breaks the table model and can confuse browsers.
css
Limited CSS on colgroup
Useful: background, width, visibility: collapse, borders with border-collapse: collapse. text-align on the group does not style cells.
layers
Paint order hides colors
Group backgrounds sit under col, row, and cell backgrounds. Opaque cells hide the group color.
deprecated
Skip presentational attributes
width, align, valign, bgcolor, char, and charoff are obsolete.
Compatibility
Browser Support
The <colgroup> element is core HTML for tables in every modern browser. Prefer CSS over deprecated presentational attributes.
✓ Baseline · Widely available
<colgroup>
Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera support column groups. CSS background and width on groups are the practical styling hooks.
98%Global support (approx.)
Google ChromeAll
Full support
Mozilla FirefoxAll
Full support
Apple SafariAll
Full support
Microsoft EdgeAll
Full support
OperaAll
Full support
Samsung InternetAll
Full support
Internet ExplorerAll
Supported
<colgroup>Widely supported
Bottom line: Safe to use for grouping columns. Pick either span-on-group or nested col — not both — and style with CSS.
Remember
Key Takeaways
Role:<colgroup> groups columns for shared styling or sizing.
Patterns:span alone, or nested <col> — never both.
Order: after caption, before header and body rows.
CSS: prefer backgrounds and width; drop deprecated HTML attributes.
One line: place <colgroup> early in the table, then either set span or nest <col> elements.
UA style
Default CSS Settings
Typical user-agent mapping for column groups:
default.css
colgroup {
display: table-column-group;
}
Visible styling comes from the limited CSS you apply to the group (or its col children) and from the cells in those columns.
Frequently Asked Questions
The colgroup element defines a group of columns in a table so you can style or size that group together, either with a span attribute or with nested col elements.
Inside table, after any caption, and before thead, tbody, tfoot, or tr.
No. If colgroup has one or more col children, omit span on colgroup. If you set span on colgroup, it must not contain col elements.
A positive integer for how many consecutive columns the group covers. Default is 1 when span is omitted and there are no col children.
No. Those attributes are deprecated. Use CSS width and style cells with text-align / vertical-align instead.
colgroup groups columns. col defines one or more columns inside a span-free colgroup for finer styling.