TBODY tag in a XHTML table

25 June 2004   2 comments   Web development

Mind That Age!

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

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

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:
Be very careful with your add_header in Nginx! You might make your site insecure 11 February 2018
jQuery and Highslide JS 08 January 2008
I'm back! Peterbe.com has been renewed 05 June 2005
Anti-McCain propaganda videos 12 August 2008
I'm Prolog 01 May 2007