TBODY tag in a XHTML table

25 June 2004   2 comments   Web development

Mind That Age!

This blog post is 13 years old! Most likely, its content is outdated. Especially if it's technical.

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.

Follow @peterbe on Twitter

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
Related by Text:
XHTML Transitional versus Strict 05 November 2004
Why should I use XHTML? 17 May 2004
DOCTYPE in PageTemplates with METAL 09 February 2004
Sequences in PostgreSQL and rolling back transactions 12 May 2009
Geeking with tags file for Jed 29 May 2006