Kanbritech Learn logo
HTML HTML Tutorial 45h track

HTML Tables

Add a JavaScript row with six available places.

Understand the topic

A table represents data whose meaning depends on rows and columns. Use table, tr, th, and td for the structure, and caption to describe the dataset. thead and tbody group header and body rows. Header cells identify relationships so people using assistive technology can understand the data. Use CSS layouts rather than tables for arranging a page.

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>

Each row contains a class name and a place count. scope="col" identifies column headers and scope="row" identifies class labels. The caption names the whole table.

Practice

Add a JavaScript row with six available places.

Show a suggested answer
<tr><th scope="row">JavaScript</th><td>6</td></tr>

Common mistake

Do not use empty cells or spaces to line up ordinary page content. Reserve tables for genuinely tabular information.

HTML documentation

Live Example

Try Coding

Result