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.

Previous:
Dan's just been to Sweden June 23, 2004 Sweden
Next:
Holiday for a week June 26, 2004
Related by category:
Fastest way to find out if a file exists in S3 (with boto3) June 16, 2017 Web development
Be very careful with your add_header in Nginx! You might make your site insecure February 11, 2018 Web development
<datalist> looks great on mobile devices August 28, 2020 Web development
How to have default/initial values in a Django form that is bound and rendered January 10, 2020 Web development