FAQ: Learn HTML - Tables - Table Headings

This community-built FAQ covers the “Table Headings” exercise in Codecademy’s lessons on HTML.

Here are the most popular community questions on this exercise:

Join the Discussion. We Want to Hear From You!

Have a new question or can answer someone else’s? Reply (reply) to an existing thread!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources about HTML in general? Go here!

Want to take the conversation in a totally different direction? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account, billing, Pro, or Pro Intensive? Reach out to our support team!

None of the above? Find out where to ask other questions here!

Other FAQs

The following are links to additional questions that our community has asked about this exercise:

  • This list will contain other frequently asked questions that aren’t quite as popular as the ones above.
  • Currently there have not been enough questions asked and answered about this exercise to populate this FAQ section.
  • This FAQ is built and maintained by you, the Codecademy community – help yourself and other learners like you by contributing!

Not seeing your question? It may still have been asked before – try searching for it by clicking the spyglass icon (search) in the top-right of this page. Still can’t find it? Ask it below by hitting the reply button below this post (reply).

2 posts were split to a new topic: Where do i put the three table headings?

Is <th> used by screen readers and does it serve any purpose other than that because the output of <tr> and <th> looks the same.

2 Likes

5 posts were split to a new topic: Should Adam’s Greenworks get a scope?

6 posts were split to a new topic: Why does the example have an empy <th>

4 posts were merged into an existing topic: This exercise discusses the scope attribute. What is the purpose of the scope attribute and are row and col the only values this attribute can have?

Table Headings

On this page, there is a bug that makes me not be able to go forward.
I click on the screen several times. It doesn’t respond at all.
Also I can’t type anything anywhere on that page.
Please let me know what I am wrong or where you have a bug.

So, in terms of <th> vs <td> is there any reason that you couldnt use <td> to create the heading of the table, and just put it in the first row instead of using <th>? Or is this one of those things where it would technically be correct but is not the best practice?

i haven t noticed any diffrence betwen “td” and “th”
so what s the diffrence

These are what we took to be semantic elements in the day. There is a big difference, albeit they have identical behaviors, for the most part. TD is a data cell. It means, ‘table data’.

We could construct our table only of them, giving the top row cells headings instead of data values. It would be valid as far as HTML is concerned. But it would also lack the semantics that tell the reader, “this row consists of the column headings for the data below”. Furthermore, we would not give data cells a scope attribute, even if they did appear at the top. It would not make sense.

Pretty much explains the difference, right there. TH is not a data cell, but a heading or descriptor cell that applies to, as in scope="col" all the data immediately below it (the column). We can also use TH at the start of each row with given, scope="row". It would tell the user agent that this cell is not data, but a descriptor for a row of TDs in the table.

Bottom line, headings with scope belong in TH cells; data belongs in TD cells.

2 Likes