- From: Liam Quinn <liam@htmlhelp.com>
- Date: Thu, 20 Mar 2003 01:28:57 -0500 (EST)
- To: Dan Smith <dan.smith@chrometoaster.com>
- cc: www-validator@w3.org
On Thu, 20 Mar 2003, Dan Smith wrote:
> My page failed to validate because of the following error:
>
> “ID ‘FOO’ already defined”
[...]
> The repeated IDs are used to match column headers in the top row of my
> table with id'd rows further down, ie:
>
> <table summary="An accessible table.">
> <tr>
> <td headers="h1">Column 1 heading</td>
> <td headers="h2">Column 2 heading</td>
> <td headers="h3">Column 3 heading</td>
> </tr>
> <tr>
> <td id="h1">Column 1 Content</td>
> <td id="h2">Column 2 Content</td>
> <td id="h3">Column 3 Content</td>
> </tr>
> <tr>
> <td id="h1">Column 1 Content</td>
> <td id="h2">Column 2 Content</td>
> <td id="h3">Column 3 Content</td>
> </tr>
> </table>
You have that backwards. The header cells should have "id" attributes
while the non-header cells have "headers" attributes:
<table summary="An accessible table.">
<tr>
<td id="h1">Column 1 heading</td>
<td id="h2">Column 2 heading</td>
<td id="h3">Column 3 heading</td>
</tr>
<tr>
<td headers="h1">Column 1 Content</td>
<td headers="h2">Column 2 Content</td>
<td headers="h3">Column 3 Content</td>
</tr>
<tr>
<td headers="h1">Column 1 Content</td>
<td headers="h2">Column 2 Content</td>
<td headers="h3">Column 3 Content</td>
</tr>
</table>
Using the "scope" attribute instead of "id" and "headers" would be simpler
in this case though:
<table summary="An accessible table.">
<tr>
<td scope="col">Column 1 heading</td>
<td scope="col">Column 2 heading</td>
<td scope="col">Column 3 heading</td>
</tr>
<tr>
<td>Column 1 Content</td>
<td>Column 2 Content</td>
<td>Column 3 Content</td>
</tr>
<tr>
<td>Column 1 Content</td>
<td>Column 2 Content</td>
<td>Column 3 Content</td>
</tr>
</table>
I would also use "th" instead of "td" for the headings.
--
Liam Quinn
Received on Thursday, 20 March 2003 01:41:58 UTC