diffsnack
HTML Find the mistake Level 10

HTML exercise: Table headers with scope — Find the bug.

Each data cell should link to its matching column heading by ID.

The exercise

Find the bug.

1<table>
2 <tr>
3 <th id="h-day">Day</th>
4 <th id="h-room">Room</th>
5 </tr>
6 <tr>
7 <td headers="h-day">Monday</td>
8 <td headers="#h-room">Room 2</td>
9 </tr>
10</table>

Solution

The bug is in line 8.

- <td headers="#h-room">Room 2</td>
+ <td headers="h-room">Room 2</td>

The headers attribute takes plain element IDs without a # prefix, not CSS selectors. Because #h-room does not match id="h-room", remove the # so the cell links to the Room heading.

Play this exercise Learn the concept: Table headers with scope