This page demonstrates the usage of various HTML tags for creating and structuring tables.
A simple table is created using the <table> tag, containing rows defined by <tr>, headers by <th>, and data cells by <td>:
| Header 1 | Header 2 |
|---|---|
| Data 1 | Data 2 |
| Data 3 | Data 4 |
The <caption> tag provides a title or description for the table:
| Month | Savings |
|---|---|
| January | $100 |
| February | $80 |
Use <th> for header cells and <td> for data cells:
| Product | Price |
|---|---|
| Apples | $1.00 |
| Oranges | $0.80 |
Cells can span multiple columns or rows using the colspan and rowspan attributes:
| Item | Description |
|---|---|
| Row 1, Cell 1 | Row 1, Cell 2 |
| Row 2, spanning two columns | |
| Row 3, spanning two rows | Row 3, Cell 2 |
| Row 4, Cell 2 | |