Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to add a caption to the table for screen readers.
HTML
<table> [1] <tr><td>Data 1</td><td>Data 2</td></tr> </table>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using instead of inside the table.
Using or which are not valid table elements.
✗ Incorrect
The
2fill in blank
mediumComplete the code to mark the first row as table headers.
HTML
<table> <tr>[1]</tr> <tr><td>Data 1</td><td>Data 2</td></tr> </table>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using instead of for headers.
Trying to use inside a which is invalid. element defines header cells in a table row, which screen readers identify as headers.
✗ Incorrect
The
3fill in blank
hardFix the error in the table to correctly associate headers with data cells using scope.
HTML
<table> <tr><th [1]>Name</th><th [1]>Age</th></tr> <tr><td>Alice</td><td>30</td></tr> </table>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using scope="row" for column headers.
Using aria-label or role attributes incorrectly.
✗ Incorrect
The scope="col" attribute tells screen readers that these headers apply to columns.
4fill in blank
hardFill both blanks to create a table with a header section and body section.
HTML
<table> [1]> <tr><th scope="col">Product</th><th scope="col">Price</th></tr> [2]> <tbody> <tr><td>Book</td><td>$10</td></tr> </tbody> </table>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using <tfoot> instead of <thead> for headers.
Forgetting to close the <thead> tag.
✗ Incorrect
The <thead> and </thead> tags wrap the header rows of a table, separating them from the body.
5fill in blank
hardFill all three blanks to add a summary attribute and ARIA label for better accessibility.
HTML
<table [1]="Sales data for 2023" [2]="sales-table" [3]="Sales Table"> <caption>Annual Sales</caption> <thead> <tr><th scope="col">Month</th><th scope="col">Revenue</th></tr> </thead> <tbody> <tr><td>January</td><td>$1000</td></tr> </tbody> </table>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using class instead of id for unique identification.
Confusing aria-label with summary.
✗ Incorrect
The summary attribute describes the table for screen readers, id gives a unique identifier, and aria-label provides an accessible name.