Advertisement
Google Ad Slot: content-top
Table
In HTML, a table is used to organize and display data in a grid format of rows and columns.
Explanation of Elements
<table>: The container for the entire table.<tr>: Defines a table row.<th>: Defines a header cell, which is typically bold and centered.<td>: Defines a standard data cell.
| Header 1 | Header 2 | Header 3 |
|---|---|---|
| Row 1, Cell 1 | Row 1, Cell 2 | Row 1, Cell 3 |
| Row 2, Cell 1 | Row 2, Cell 2 | Row 2, Cell 3 |
Additional Table Elements
<caption>: Adds a title to the table.<colspan>: Allows a cell to span multiple columns.<rowspan>: Allows a cell to span multiple rows.
| Name | Details | |
|---|---|---|
| John | Age: 22 | City: Boston |
| Jane | City: Seattle | |
Styling Tables
Tables can be styled with CSS to improve their appearance.
| Header 1 | Header 2 | Header 3 |
|---|---|---|
| Row 1, Cell 1 | Row 1, Cell 2 | Row 1, Cell 3 |
| Row 2, Cell 1 | Row 2, Cell 2 | Row 2, Cell 3 |