TBODY tag in a XHTML table

25 June 2004   2 comments   Web development

Powered by Fusion×

For all HTML language lawyers out there... I've got a page that is defined as XHTML 1.0 Transitional and in it I use a table that has many <tbody> tags, in these I have a class definition like this:

<table>
  <tr>
    <th>No</th><th>Name</th>
  </tr>
  <tbody class="foo">
    <tr>
      <td>1.</td><td>One</td>       
    </tr>
  </tbody>
</table>

That was not valid XHTML according to the W3C Validator and it took me some time to figure out why. Now I've got it! One has to use the thead tag too if you want to use the tbody tag. Here's an example:

<table>
  <thead>
    <tr>
      <th>No</th><th>Name</th>
    </tr>
  </thead>
  <tbody class="foo">
    <tr>
      <td>1.</td><td>One</td>       
    </tr>
  </tbody>
</table>

Worth remembering.

Comments

abhinav
hi,

your site in very simple and not attractive....design purpose

so i hope you re-design.
abhinav
Thanks for the article. It was useful.

That's a very unproductive comment abhinav.

Regards,
Daniel
Thank you for posting a comment

Your email will never ever be published


Related posts

Previous:
Dan's just been to Sweden 23 June 2004
Next:
Holiday for a week 26 June 2004