Table Headers and Structure
Semantic table structure improves accessibility and allows for better styling. Learn about thead, tbody, tfoot, and scope attributes.
Table Sections
Loading HTML Playground...
Table sections:
<thead>- Header rows<tbody>- Body rows (main data)<tfoot>- Footer rows (summaries)
Scope Attribute
Loading HTML Playground...
The scope attribute:
col- Header for a columnrow- Header for a rowcolgroup- Header for a group of columnsrowgroup- Header for a group of rows
This is essential for screen readers to associate data with headers.
Column Groups
Loading HTML Playground...
Column groups (<colgroup> and <col>):
- Style entire columns
spanattribute affects multiple columns
Multiple Header Rows
Loading HTML Playground...
Complex headers use colspan and rowspan (covered in next lesson).
Styling Table Sections
Loading HTML Playground...
Exercise: Create Structured Table
Create a table with proper semantic structure:
Loading HTML Exercise...
Semantic table structure makes tables accessible and easier to style!

