The tbody element groups the main data rows. Thead groups header rows, while tfoot groups footer or summary rows.
Answer 4: B — scope="col" and scope="row"
scope="col" identifies a header associated with a column, and scope="row" identifies a header associated with a row. These values are commonly used in simple data tables.
Answer 5: B — The cell occupies three columns
The colspan attribute controls the number of columns occupied by a table cell. It is useful for grouped headings and summary cells that span multiple columns.
Answer 6: B — The cell occupies two rows
The rowspan attribute controls the number of rows occupied by a cell. Other cells must be arranged around the spanning cell so that the table grid remains correct.
Answer 7: True
The headers attribute contains a space-separated list of IDs identifying header cells associated with the current cell. This is useful when a table has relationships that are too complex to communicate with simple scope values alone.
Answer 8: C — colgroup and col
colgroup groups columns, while col identifies one or more columns within a group. These elements can help with column-level styling and structural organization.
Answer 9: C — Use meaningful header cells and explicit header associations when needed
Complex tables require clear relationships between data and the relevant headers. Meaningful th elements, unique IDs and the headers attribute can provide explicit associations when necessary.
Answer 10: B — Use a horizontally scrollable container when needed
A wrapper with overflow-x: auto allows a wide table to scroll horizontally on narrow screens. This preserves the tabular structure while making the content more usable on smaller devices.
20. Final Revision Checklist
- I understand table, tr, th and td.
- I can add a meaningful caption.
- I can organize rows using thead, tbody and tfoot.
- I understand the difference between row and column headers.
- I can use scope to clarify simple header relationships.
- I can merge cells using colspan and rowspan.
- I understand how id and headers support complex tables.
- I know the purpose of colgroup and col.
- I can style tables with CSS and make wide tables usable on small screens.
- I understand why tables should represent data rather than general page layout.
- I have completed the practical exercises and reviewed all 10 quiz answers.
Lesson Completion
Congratulations! You have completed Section 10 of Codementrix HTML5 Mastery.
You now understand how to build structured HTML tables, add captions, identify headers, merge cells and improve accessibility for tabular data.
Next lesson: Section 11 — Semantic HTML5.