Skip to main content

The <colgroup> Element

As defined in the HTML Living Standard, the <colgroup> element represents a group of one or more columns in the table that is its parent. It acts as a container for <col> elements.

Category Metric A Metric B
Usability 95% 88%
<table> <colgroup> <col style="width: 150px"> </colgroup> <colgroup class="highlight-group"> <col span="2"> </colgroup> ... </table> View HTML Living Standard: The colgroup element

Usage Rules & Hierarchy

WCAG Requirement: Info and Relationships

Success Criterion 1.3.1 (Level A): Information, structure, and relationships conveyed through presentation can be programmatically determined.

Using <colgroup> helps define the structural "bone" of the table. While it doesn't provide direct feedback to screen readers like a header cell does, it allows browsers to pre-calculate table dimensions and relationships, leading to more robust rendering of the accessibility tree for complex data sets.

Understand SC 1.3.1: Info and Relationships

Styling Benefits

The primary utilitarian benefit of <colgroup> is applying styles to entire vertical sections of a table without having to repeat classes on every individual <td> or <th> cell.

A11y Tip: Meaningful Color

If you use <colgroup> to color-code sections of a table, ensure the color is not the only way to convey meaning, satisfying WCAG SC 1.4.1 (Use of Color). Always provide text-based labels in the header cells.