BA list of names and ages without any table structure or borders.
COnly the header row with 'Name' and 'Age' is shown, no data rows appear.
DA table with two columns labeled 'Name' and 'Age' and two rows: 'Alice 30' and 'Bob 25'.
Attempts:
2 left
💡 Hint
Remember that defines the header row and contains the data rows.
✗ Incorrect
The
element contains a header row inside with two columns: 'Name' and 'Age'. The has two rows with data cells. The browser renders this as a table with headers and two rows of data.
📝 Syntax
intermediate
2:00remaining
What error does this HTML table code cause?
Examine this HTML snippet. What problem will it cause when rendered?
ANo error; the table renders correctly with header and body rows.
BThe table will not render because <tr> must be inside <thead> or <tbody>.
CThe browser ignores the first <tr> because it is outside <thead> or <tbody>.
DThe browser shows a warning but still renders the table with duplicated headers.
Attempts:
2 left
💡 Hint
Check where the
with headers is placed relative to and
.
✗ Incorrect
No error; the table renders correctly with header and body rows. Although <tr> should be inside <thead>, <tbody>, or <tfoot>, browsers recover by inserting an implicit <tbody> before the explicit one, placing the first <tr> there. The first row appears header-like due to <th> elements.
❓ selector
advanced
2:00remaining
Which CSS selector styles only the header cells in this table?
Given a table with and , which CSS selector targets only the header cells (
CSS Grid uses grid-template-columns to define column widths.
✗ Incorrect
Setting the table to display: grid and using grid-template-columns: repeat(3, 1fr) with thead, tbody { display: contents; } makes the <tr> elements direct grid items, creating three equal columns. Flexbox doesn't create columns in tables properly. column-count is for multi-column text layout, not tables. display: block removes table layout and grid-template-columns won't work without display: grid.
❓ accessibility
expert
2:00remaining
Which attribute improves accessibility by linking table headers to data cells?
To help screen readers understand which headers relate to which data cells in a complex table, which attribute should you use on
elements that act as headers for that cell. This helps screen readers associate data cells with their headers in complex tables. 'aria-labelledby' is used for labeling elements but not typically for table cell-header linking. 'scope' is used on
to define header scope. 'role' defines ARIA roles but does not link headers to cells.