Skip to main content
HTML Validation

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

About This HTML Issue

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

<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

<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>

Find issues like this automatically

Rocket Validator scans thousands of pages in seconds, detecting HTML issues across your entire site.

Help us improve our guides

Was this guide helpful?
🌍 Trusted by teams worldwide

Validate at scale.
Ship accessible websites, faster.

Automated HTML & accessibility validation for large sites. Check thousands of pages against WCAG guidelines and W3C standards in minutes, not days.

Scheduled Reports
API Access
Open Source Standards
€5 / week

1K Weekly

1,000 monthly checks. Cancel anytime.

Get 1K Weekly →

Join teams across 40+ countries