# Bad value “” for attribute “colspan” on element “td”: The empty string is not a valid positive integer.

> Canonical HTML version: https://rocketvalidator.com/html-validation/bad-value-for-attribute-colspan-on-element-td-the-empty-string-is-not-a-valid-positive-integer
> Attribution: Rocket Validator (https://rocketvalidator.com)
> License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

An empty `colspan` on a `<td>` is invalid, because the attribute takes the number of columns the cell spans, a whole number from 1 to 1000.

Both `colspan=""` and a bare `colspan` with no value get this error. A value made only of spaces, like `colspan=" "`, gets a different one that starts with "Expected a digit".

Empty attributes like this usually come from a table builder in a CMS, or from a template that prints `colspan="{{ cell.colspan }}"` on every cell, whether or not the cell spans anything. The same templates often print `rowspan=""` too, which gets its own error saying "non-negative integer" instead, because `rowspan` also accepts 0.

Browsers treat an empty `colspan` as 1, the same as leaving the attribute out, so the table looks the same once you remove it. Change the template to print `colspan` only when the cell spans two or more columns.

## Invalid example

```html
<table>
  <tr>
    <th>Plan</th>
    <th>Price</th>
  </tr>
  <tr>
    <td colspan="">Basic</td>
    <td colspan="">$10</td>
  </tr>
  <tr>
    <td colspan="2">Prices include tax.</td>
  </tr>
</table>
```

## Valid example

```html
<table>
  <tr>
    <th>Plan</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>Basic</td>
    <td>$10</td>
  </tr>
  <tr>
    <td colspan="2">Prices include tax.</td>
  </tr>
</table>
```
