Kanbritech Learn logo
HTML HTML Tutorial 45h track

Table Headers

Write a row header for a course named Python.

Understand the topic

Header cells describe rows or columns. Use th rather than merely bold text in td, and supply scope when the relationship is simple. For complex multi-level tables, explicit id and headers associations may be needed. Prefer a simpler table whenever possible because a visually impressive header arrangement can be difficult to interpret nonvisually.

Worked example

<table><caption>Workshop places</caption><thead><tr><th scope="col">Class</th><th scope="col">Places</th></tr></thead><tbody><tr><th scope="row">HTML</th><td>12</td></tr><tr><th scope="row">CSS</th><td>8</td></tr></tbody></table>

Class and Places are column headers. HTML and CSS are row headers. A cell such as 12 can therefore be understood as the number of places for HTML.

Practice

Write a row header for a course named Python.

Show a suggested answer
<tr><th scope="row">Python</th><td>10</td></tr>

Common mistake

A bold td is still a data cell. Visual weight alone does not establish a header relationship.

HTML documentation

Live Example

Try Coding

Result