Skip to main content
HTML Validation

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

About This HTML Issue

A colspan on a <th> has to say how many columns the header covers, as a whole number from 1 to 1000, so colspan="" is invalid.

Writing colspan with no value at all gives the same message. If the value holds only spaces, as in colspan=" ", the validator reports it differently, with a message that begins "Expected a digit".

Header cells often end up like this when a table plugin or theme writes the span attributes on every <th> and fills them from a setting that is blank for most columns. Check the same headers for rowspan="". The validator flags it separately, as "not a valid non-negative integer", because rowspan also accepts 0.

An empty colspan changes nothing on screen: browsers read it as 1, just as they do when the attribute is missing. Remove it from every header that sits over a single column, and keep a number only where a header groups several columns, such as colspan="2" above two related columns.

Invalid example

<table>
  <tr>
    <th colspan="">Course</th>
    <th colspan="2">Schedule</th>
  </tr>
  <tr>
    <td>Biology</td>
    <td>Monday</td>
    <td>Wednesday</td>
  </tr>
</table>

Valid example

<table>
  <tr>
    <th>Course</th>
    <th colspan="2">Schedule</th>
  </tr>
  <tr>
    <td>Biology</td>
    <td>Monday</td>
    <td>Wednesday</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