Table Basics
HTML tables display data in rows and columns. They're designed for tabular data, not page layout.
Basic Table Structure
Loading HTML Playground...
Basic elements:
<table>- Table container<tr>- Table row<td>- Table data cell
Adding Headers
Loading HTML Playground...
The <th> element:
- Defines header cells
- Bold and centered by default
- Important for accessibility
Table with Caption
Loading HTML Playground...
The <caption> element:
- Provides a title for the table
- Must be first child of table
- Helps users understand the table's purpose
Cell Content
Loading HTML Playground...
Cells can contain any HTML content.
Basic Table Styling
Loading HTML Playground...
Key CSS properties:
border-collapse: collapse- Removes gaps between cells:nth-child(even)- Zebra striping
Exercise: Create a Data Table
Create a simple table with headers:
Loading HTML Exercise...
Tables are essential for presenting structured, tabular data on the web!

