th
A header cell that labels row or column data.
Learn Table Headers with practical examples for tables, lists, structured data relationships, accessibility, SEO and live practice.
HTML data structures
A table without proper headers can look readable to sighted users but become confusing for screen reader users and anyone scanning complex data.
Header cells use th, not td. A column header labels values below it. A row header labels values beside it.
For simple tables, scope is usually enough. For complex tables, ids and headers can create more precise relationships.
A header cell that labels row or column data.
The header applies to cells below it in the same column.
The header applies to cells beside it in the same row.
A more explicit relationship for complex tables.
Syntax and structure
A bold td looks like a header. A th behaves like a header.
<table> <caption>Course modules</caption> <tr> <th scope="col">Module</th> <th scope="col">Level</th> <th scope="col">Status</th> </tr> <tr> <th scope="row">HTML Tables</th> <td>Beginner</td> <td>Ready</td> </tr> </table>
<table> <tr><td><strong>Module</strong></td><td><strong>Status</strong></td></tr> <tr><td>HTML Tables</td><td>Ready</td></tr> </table>
HTML quick reference
Use these patterns when you need the syntax quickly. Each example has its own anchor, so search engines and readers can land directly on the exact pattern instead of only at the top of the lesson.
A clean version of the markup from this lesson. Use it when you need the correct HTML shape quickly.
<table> <caption>Course modules</caption> <tr> <th scope="col">Module</th> <th scope="col">Level</th> <th scope="col">Status</th> </tr> <tr> <th scope="row">HTML Tables</th> <td>Beginner</td> <td>Ready</td> </tr> </table>
Meaningful markup that stays understandable before CSS and JavaScript are added.
The starting point from the practice lab. Change the HTML first, then use CSS only for presentation.
<main class="demo-card"> <table> <caption>Training modules</caption> <tr><th scope="col">Module</th><th scope="col">Difficulty</th><th scope="col">Done</th></tr> <tr><th scope="row">Mirrors</th><td>Basic</td><td>Yes</td></tr> <tr><th scope="row">Highway</th><td>Advanced</td><td>No</td></tr> </table> </main> <style> body { margin: 0; min-height: 100vh; display: grid; place-items: center; font-family: Inter, system-ui, sans-serif; background: #07111f; color: white; } .demo-card { width: min(820px, calc(100% - 32px)); padding: 34px; border-radius: 24px; background: #101a2d; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); } h1 { margin: 0 0 18px; font-size: clamp(32px, 6vw, 54px); line-height: 1; } table { width: 100%; border-collapse: collapse; color: #f7f7f4; } caption { caption-side: top; margin-bottom: 12px; color: #8cffc1; font-weight: 900; text-align: left; } th, td { border-bottom: 1px solid rgba(255, 255, 255, 0.14); padding: 13px 14px; text-align: left; vertical-align: top; } th { color: #8cffc1; font-weight: 900; } ul, ol { display: grid; gap: 10px; margin: 0; padding-left: 24px; color: #cfd8e6; } li::marker { color: #8cffc1; font-weight: 900; } dl { margin: 0; } </style>
A complete practice snippet that shows how the HTML behaves in context.
A weak pattern from the lesson. Use it as a warning sign when reviewing real pages.
<table> <tr><td><strong>Module</strong></td><td><strong>Status</strong></td></tr> <tr><td>HTML Tables</td><td>Ready</td></tr> </table>
A recognizable mistake you can search for and refactor.
Rules that matter
Tables and lists are small elements with big structural value. They help users scan, compare, follow steps and understand how pieces of information belong together.
If a cell labels other cells, it should probably be th.
scope="col" and scope="row" make relationships clear.
A header should be easy to repeat mentally while reading values.
Empty headers create unclear relationships.
The caption names the table, headers name the columns and rows.
Spanning or grouped headers may need explicit relationships.
Production thinking
This matters because a number without its label is just noise. Headers turn values into information.
Correct headers let assistive technology announce the meaning of a value, not only the value itself.
Data exported from CMS or spreadsheets often loses header quality. Validate generated tables before publishing.
Clear headers help crawlers and users understand comparison data, specifications and structured information.
Live code lab
Edit the HTML or CSS, then use Run to refresh the preview. The preview is isolated, so links and forms stay inside this practice area.
Mini assignment
Practice assignment
Try it yourself
Self-check
Do not only read this page. Answer these questions out loud or write the answers in your own notes. If one answer feels vague, revisit the examples before moving on.