# Table columns in range X…Y established by element “col” have no cells beginning in them.

> Canonical HTML version: https://rocketvalidator.com/html-validation/table-columns-in-range-x-y-established-by-element-col-have-no-cells-beginning-in-them
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

The `<col>` elements in this table declare more columns than the rows use, and no `<td>` or `<th>` begins in the reported range.

Each `<col>` inside a `<colgroup>` adds one column to the table, or as many columns as its `span` attribute says, so `<col span="4">` declares four. The HTML table model requires every column to have at least one cell that starts in it. A cell that only crosses a column through `colspan` doesn't count. With `<col span="4">` and rows made of `<th colspan="4">`, or of `<td>` followed by `<td colspan="3">`, cells start only in columns 1 and 2, and the validator reports columns 3 and 4 together as the range `3…4`.

This often happens in layout tables that declare a fine grid in the `<colgroup>` and then merge those columns with `colspan` in every row. It also happens when the rows are shorter than the column markup, which adds a second error: "A table row was 2 columns wide, which is less than the column count established using column markup (4)". When only one column is empty, the validator names that single column ("Table column 4") instead of a range.

To fix it, declare only the columns the rows use. Remove `<col>` elements or lower their `span`, and reduce the `colspan` values to match. Deleting the `<colgroup>` alone isn't enough: the oversized `colspan` then creates the empty columns itself, and the validator reports them as established by `th` or `td` instead.

## Invalid example

The `<col>` declares four columns, but cells start only in the first two:

```html
<table>
  <colgroup>
    <col span="4">
  </colgroup>
  <tr>
    <th colspan="4">Opening hours</th>
  </tr>
  <tr>
    <td>Monday</td>
    <td colspan="3">9:00 to 17:00</td>
  </tr>
</table>
```

## Valid example

Two columns in the `<colgroup>`, and a cell starts in each of them:

```html
<table>
  <colgroup>
    <col class="day">
    <col class="hours">
  </colgroup>
  <tr>
    <th colspan="2">Opening hours</th>
  </tr>
  <tr>
    <td>Monday</td>
    <td>9:00 to 17:00</td>
  </tr>
</table>
```
