---
url: "https://www.w3.org/WAI/tutorials/tables/irregular/"
titulek: "Tables with Irregular Headers | Web Accessibility Initiative (WAI) | W3C"
h1: "Tables with Irregular Headers"
popis: "Accessibility resources free online from the international standards organization: W3C Web Accessibility Initiative (WAI)."
jazyk: "en"
kanonicka: "https://www.w3.org/WAI/tutorials/tables/irregular/"
drobecky: ["Home", "Design & Develop", "Tutorials", "Tables", "Irregular Headers"]
zdroj: "live"
wayback_snapshot: ""
stazeno: "2026-09-14 00:22:26"
znaku: 2649
slov: 462
kodovani: "utf-8"
sha256: "21d18dcd3542fd33aa9b6e7d489ab9d0916eafab27b2f2a1230aa53b6dccfda2"
---
For example, a header cell that spans three columns should be associated with corresponding data cells in the column group. This can be done by setting the `scope` attribute of the header cell to the value `colgroup`. The same principle applies to header cells spanning multiple rows. In this case, they are associated with by using the value `rowgroup` in the `scope` attribute.
However, before making these associations, the structure of such groups of columns and rows needs to be defined in the table markup:
- A column group is defined using the `
` element.
- A row group is defined by the `` , `` and `` elements.
- `` and `` elements can be used once in a table.
- A table can have any number of `` elements that each defines a row group.
## Table with two tier headers
In the table below, there are two pairs of column headers. Each pair of column headers, “Produced” and “Sold” is associated with a first-level header that identifies the pair: “Mars” and “Venus”. These first-level headers are made to span two columns by using the `colspan` attribute with the value of `2`.
The column structure needs to be defined at the beginning of the table to associate first-level headers correctly with all cells of both columns. A `` element identifies each column, beginning on the left. If a header spans two or more columns, use a `` element instead of that number of `` elements, and the number of columns spanned is noted in the `span` attribute.
Also, the value of the `scope` attribute in the first-level headers is set to `colgroup` so that it is associated with the entire group of columns. The second-level headers only apply to the corresponding column, so the `scope` attribute is set to `col` as shown in previous examples.
## Table with headers spanning multiple rows or columns
In the example below, the table consists of two individual columns and one column group spanning three columns. It has six rows. Two headers that span multiple rows. To make sure that such header cells that span multiple rows are correctly associated with all the cells in those rows, the rows must be grouped. To define row groups wrap the corresponding rows in `` elements (table body). Additionally, the `scope` attribute of header cells spanning rows has to be set to `rowgroup`.
If a header spans multiple header rows, wrap the rows in a `` element instead of a `` element. Use a `` element if a header spans multiple rows in the footer area of a table.
Due to the complexity of the table a [summary technique](/WAI/tutorials/tables/caption-summary/) could be used to describe the layout of the table in detail.
Back to Top