Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 620365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:45:21+00:00 2026-05-13T18:45:21+00:00

is it necessary to have <th> in any table? even if table has no

  • 0

is it necessary to have <th> in any table? even if table has no heading?

table has 3 other tag <thead> <tbody> <tfoot> is it necessary to use all even if i have nothing for table footer. Firefox by default add all these in code.

and is it necessary , <th> always should be in a <thead>

and if I have a heading in content received from client , and heading is from outside the table but related to table then how should i place that heading for table

As a above table

<h3>Heading of table<h3>
<table>......</table>

as a heading of table

<table>
<thead><tr rowspan=3><th>Heading of table</th></tr></thead>

or as a caption of table

<table>
<caption> Heading of table</caption>

Which is good for screen reader and semantically correct?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T18:45:21+00:00Added an answer on May 13, 2026 at 6:45 pm

    According to the HTML DTD this is the content model for HTML tables:

    <!ELEMENT TABLE - -
         (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)>
    <!ELEMENT CAPTION  - - (%inline;)*     -- table caption -->
    <!ELEMENT THEAD    - O (TR)+           -- table header -->
    <!ELEMENT TFOOT    - O (TR)+           -- table footer -->
    <!ELEMENT TBODY    O O (TR)+           -- table body -->
    <!ELEMENT COLGROUP - O (COL)*          -- table column group -->
    <!ELEMENT COL      - O EMPTY           -- table column -->
    <!ELEMENT TR       - O (TH|TD)+        -- table row -->
    <!ELEMENT (TH|TD)  - O (%flow;)*       -- table header cell, table data cell-->
    

    So this is illegal syntax:

    <thead><th>Heading of table</th></thead>
    

    It should be:

    <thead><tr><th>Heading of table</th></tr></thead>
    

    <th> elements aren’t required anywhere. They’re simply one of the two cell types (the other being <td>) that you can use in a table row. A <thead> is an optional table section that can contain one or more rows.

    Edit: As to why to use <thead> there are several reasons:

    1. Semantic: You’re differentiating between the content of your table and “metadata”. This is most often used to delineate between column headers and data rows;
    2. Accessibility: it helps people who use screen readers to understand the contents of the table;
    3. Non-Screen Media: Printing a multi-page table may allow you to put the <thead> contents at the top of each page so people can understand what the columns meaning without flicking back several pages;
    4. Styling: CSS can be applied to <tbody> elements, <thead> elements, both or some other combination. It gives you something else to write a selector against;
    5. Javascript: this often comes up when using jQuery and similar libraries. The extra information is helpful in writing code.

    As an example of (5) you might do this:

    $("table > tbody > tr:nth-child(odd)").addClass("odd");
    

    The <thead> element means those rows won’t be styled that way. Or you might do:

    $("table > tbody > tr").hover(function() {
      $(this).addClass("hover");
    }, function() {
      $(this).removeClass("hover");
    });
    

    with:

    tr.hover { background: yellow; }
    

    which again excludes the <thead> rows.

    Lastly, many of these same arguments apply to using <th> elements over <td> elements: you’re indicating that this cell isn’t data but a header of some kind. Often such cells will be grouped together in one or more rows in the <thead> section or be the first cell in each row depending on the structure and nature of your table.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it necessary to use Nothing keyword to initialize a DataSet in VB.NET?
Is it necessary for setter methods to have one argument? Usually setter methods accept
Are hints really necessary for every sql statement? We have a dba who is
Are CDATA tags ever necessary in script tags and if so when? In other
The question gives all necessary data: what is an efficient algorithm to generate a
I have been trawling google for answers to this but no luck. Any help
Ok, I have a database with with a table for storing classified posts, each
I have a database with a documents table DocumentID DocTitle DocDesc and a keyword
I am creating an application with a table view, which has a large amount
I have a table in which in one of the column I would be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.