# Bad value “” for attribute “rowspan” on element “th”: The empty string is not a valid non-negative integer.

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

A `rowspan` on a `<th>` sets how many rows the header cell covers, and it only accepts a whole number from 0 to 65534, so `rowspan=""` fails validation.

The validator reports a bare `rowspan`, written with no value, in exactly the same way. A value that holds only spaces, or a negative number such as `-1`, produces another message instead, one that begins with "Expected a digit".

The usual source is a header row generated by a table plugin or theme that prints `rowspan` and `colspan` on every `<th>` and leaves them blank when the cells aren't merged. Look at those headers for `colspan=""` as well. The validator flags it in a separate message, "not a valid positive integer", because `colspan` has to be at least 1.

An empty `rowspan` makes no visual difference: browsers read it as 1, the same value they use when the attribute is absent, so you can delete it safely. Avoid swapping in `rowspan="0"`. That value passes validation, but it makes the header reach down to the last row of its `<thead>`, `<tbody>` or `<tfoot>`. Leave `rowspan` only on headers that span two or more rows, such as a row header that labels a group of rows.

## Invalid example

```html
<table>
  <tr>
    <th rowspan="">Region</th>
    <th rowspan="">Store</th>
    <th rowspan="">Sales</th>
  </tr>
  <tr>
    <th rowspan="2">North</th>
    <td>Leeds</td>
    <td>1,200</td>
  </tr>
  <tr>
    <td>York</td>
    <td>950</td>
  </tr>
</table>
```

## Valid example

```html
<table>
  <tr>
    <th>Region</th>
    <th>Store</th>
    <th>Sales</th>
  </tr>
  <tr>
    <th rowspan="2">North</th>
    <td>Leeds</td>
    <td>1,200</td>
  </tr>
  <tr>
    <td>York</td>
    <td>950</td>
  </tr>
</table>
```
