# A table row was X columns wide, which is less than the column count established using column markup (Y).

> Canonical HTML version: https://rocketvalidator.com/html-validation/a-table-row-was-x-columns-wide-which-is-less-than-the-column-count-established-using-column-markup-y
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

A row in this table has fewer cells than its `<colgroup>` and `<col>` elements declare, so the row ends before the last column the markup defines.

Column markup sets the column count before any row is read. Each `<col>` adds one column, or as many as its `span` attribute says, and a `<colgroup>` with no `<col>` inside adds the number in its own `span`. A row is X columns wide when its cells add up to X, counting each cell's `colspan` and any cell from a row above that reaches down with `rowspan`. The validator reports this error once for every row narrower than the Y columns the markup declares. When no row reaches column Y at all, it also reports that table column Y established by element `col` (or `colgroup`) has no cells beginning in it.

A common cause is a column deleted from the rows while its `<col>` stays in the `<colgroup>`, for example after removing a column in a visual table editor. Without column markup, a short row only gets a warning. With it, the validator reports an error.

To fix it, make the column markup and the rows agree. If the column is gone, remove its `<col>` or lower the `span`. If the column should stay, add the missing cells to each short row, with an empty `<td></td>` where there is no data. A `colspan` on the last cell of a short row also clears this error, but when no row has a cell that starts in the last column, the validator then reports that column as having no cells.

## Invalid example

The `<colgroup>` declares four columns, but each row has three cells:

```html
<table>
  <colgroup>
    <col class="item">
    <col class="size">
    <col class="price">
    <col class="stock">
  </colgroup>
  <tr>
    <th>Item</th>
    <th>Size</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>T-shirt</td>
    <td>M</td>
    <td>15.00</td>
  </tr>
</table>
```

## Valid example

The `<col>` for the removed column is gone, so the markup declares three columns:

```html
<table>
  <colgroup>
    <col class="item">
    <col class="size">
    <col class="price">
  </colgroup>
  <tr>
    <th>Item</th>
    <th>Size</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>T-shirt</td>
    <td>M</td>
    <td>15.00</td>
  </tr>
</table>
```
