Re: Potential false positive in validator?

7.9.2015, 14:25, Alexander wrote:

> I checked the document attached

Here is the relevant code:

<table>
<caption>Tournament</caption>
<thead>
<tr>
<th class="c1">Round</th>
<th class="c1">Field</th>
<th class="c1">Players</th>
<th class="c2" colspan="3">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="1">1</td>
<td colspan="5">Byes: Thomas</td>
</tr>
</tbody>
</table>

> and got the following error:
>
> "Table columns in range 5…6 established by element th have no cells beginning in them.“

The table has six columns, but the last two columns aren’t “real”, to 
put it informally. They are really just an extension of the fourth column.

> However, I suppose the document is valid

It isn’t. It violates the mandatory requirements on tables in the HTML5 
specification, as presented in “4.9.12 Processing model” (an oddly named 
section, since it specifies structural requirements), at
http://www.w3.org/TR/html5/tabular-data.html#processing-model-1

To fix this, simply make it a four-column table:

<table>
<caption>Tournament</caption>
<thead>
<tr>
<th class="c1">Round</th>
<th class="c1">Field</th>
<th class="c1">Players</th>
<th class="c2">Result</th>
</tr>
</thead>
<tbody>
<tr>
<td rowspan="1">1</td>
<td colspan="3">Byes: Thomas</td>
</tr>
</tbody>
</table>

If you want to make the fourth column wider than the others, just let 
browsers do that on the basis of its content (if it needs more width 
than other columns) or set the column widths in CSS. The colspan 
attribute is a wrong tool for that.

Yucca

Received on Friday, 11 September 2015 18:33:37 UTC