How are table headers supposed to be used?

Posted by stevebot on Stack Overflow See other posts from Stack Overflow or by stevebot
Published on 2010-12-27T18:40:06Z Indexed on 2010/12/27 18:53 UTC
Read the original article Hit count: 185

Filed under:

Hi,

Recently I saw some code like this:

<tr> 
     <th> Some label: </th>
     <td> <input type="text" value=""/> </td>
     <th> Another label: </th>
     <td> <input type="text" value=""/> </td>
</tr>

I am used to table headers being used like

<tr> 
     <th> Some label: </th>
     <th> Another label: </th>
</tr>
<tr>
     <td> <input type="text" value=""/> </td>
     <td> <input type="text" value=""/> </td>
</tr>

How are table headers supposed to be used? The first example above, lead me to some pretty funky formatting issues, and it seems like in example 1 <label> should be used in place of <th>.

© Stack Overflow or respective owner

Related posts about html