HTML Table Tags

This page demonstrates the usage of various HTML tags for creating and structuring tables.

Basic Table Structure

A simple table is created using the <table> tag, containing rows defined by <tr>, headers by <th>, and data cells by <td>:

Sample Table
Header 1 Header 2
Data 1 Data 2
Data 3 Data 4

Table with Caption

The <caption> tag provides a title or description for the table:

Monthly Savings
Month Savings
January $100
February $80

Table Headers and Data Cells

Use <th> for header cells and <td> for data cells:

Product Price
Apples $1.00
Oranges $0.80

Merging Cells

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

Homepage