Content · Web Development · HTML

HTML <th> Element: Reference and Examples

A clear, practical element reference to th. Learn when to use it, see working HTML, and avoid common mistakes.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

The <th> element is used for mark a header cell that explains nearby data. You will run into it while reading other people’s HTML, and it is useful to know what job it does before copying the code.

What does <th> mean?


Mark a header cell that explains nearby data. The tag gives the browser a specific kind of content to work with. It is more helpful to choose a tag for its meaning than because of its default look.

Scope col or row can clarify which cells a th header describes.

A working HTML example


Here is a small example you can place in an HTML page and inspect in your browser:

<table>
    <tr><th scope="col">Month</th><th scope="col">Visitors</th></tr>
    <tr><th scope="row">January</th><td>340</td></tr>
</table>

Reading the example


Find the <th> part first. Notice which elements are around it and how its content or attributes are connected to those other elements.

In this example, <th> appears alongside tr, scope, headers. That context is often just as important as the element itself.

The browser builds its document from these relationships. Any CSS changes appearance, while interactive JavaScript behavior must be provided separately when the example includes it.

When should you use it?


Use <th> when you want to mark a header cell that explains nearby data. A sensible example of this on a real website is the markup shown above; it gives the browser and accessibility tools a clearer job to work with.

Common companions are tr, scope, headers. Check the nesting requirements before moving the element into a different location.

Try it yourself


Add a row header and compare how assistive technology announces the cells.

Common Beginner Mistakes


  • Visually bold text alone is not a substitute for a real table header.
  • Picking <th> only because it looks a certain way instead of checking what it means.
  • Forgetting to inspect the surrounding markup when an element does not behave as expected.

Key Takeaways


  • <th> helps mark a header cell that explains nearby data.
  • Scope col or row can clarify which cells a th header describes.
  • Start with meaningful markup, then add styling or scripting only when the page needs it.
Share this resourceSend this page to someone who may find it useful.