Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

HTML HTML Tables Structuring Tables The Table Head and Body Elements

Andre Kucharzyk
Andre Kucharzyk
4,479 Points

Why use both <th scope="col"> and <thead>

Why in this exercise we are using both <th> and <thead>? Arent they synonymous?

  <thead>
    <tr>
      <th scope="col">Name</th>
      <th scope="col">E-mail</th>
      <th scope="col">Job role</th>
    </tr>
  </thead>

2 Answers

Steven Parker
Steven Parker
218,691 Points

As you can see from the example, the thead element encloses rows to identify them as header rows. It doesn't display anything in itself.

The th element is an actual cell that will contain header content to be displayed. It would be inside a row.

As to the scope attribute, it's true that heading cells in a thead row would generally relate to a column, but their might be some value (perhaps for styling or scripting) in explicitly defining their scope with the attribute.


The potential uses of the thead element and the scope attribute are not quite the same. The thead indicates entire rows containing heading header information. This could be used to include the header rows on each page of a printed, multi-page table, or to present a long table with a scrolling body and static header rows.

The scope attribute defines which cells a specific th header cell relates to. The th element is not only used for column headers, nor is it restricted to rows in a thead. The scope attribute might be used to give special styling to certain header cells based on their function.

Andre Kucharzyk
Andre Kucharzyk
4,479 Points

The scope="col" as well as thead element don't display anything in itself, so i don't get your point.

My question was why would you use both simultaneously when they achieve same exact thing.

Steven Parker
Steven Parker
218,691 Points

It depends on how you use them, they could be used for the same thing, but their usage could also be very different. I extended my original answer with some examples.