Sectioning off the table headings doesn’t appear to change anything. Why does it “make sense to section off the table headings”?

Question

Sectioning off the table headings doesn’t appear to change anything. Why does it “make sense to section off the table headings”?

Answer

While the <thead>, <tbody>, and <tfoot> (next exercise) tags may not affect the appearance of tables, they do create semantic meaning which can improve the user experience in a number of ways. For instance, with just a bit of CSS the <thead> tag allows developers to more readily target table headings and style them such that this information can be seen while scrolling through long tables.

What’s more, these semantic tags allow software like screen readers and search engines to make better sense of our table content.

20 Likes

Thanks, For such Clear Explanation.

11 Likes

Makes sense!, Thank you for the information! :+1:

3 Likes

would it make sense to think of thead like div but for tables?

1 Like

It does make sense but i don’t recommand that you do. The reason being thead element is mainly used to provide semantic value by clearly separating the header and body contents which makes easier for assistive technologies (screen readers, etc) to understand the structure of the table.
div element has almost no semantic value (it can have through id and class attributes which can help indexing the web page) and should be used when no other element ‘fit the bill’ (not sure about this expression, forgive me for english isn’t my first language) or mainly as a container for styling.

So yes, you can treat both elements as containers but keep in mind that their function / end goal is different.

1 Like