Basic Table Structure
Tables in HTML are used to display tabular data (data arranged in rows and columns).
Header 1 | Header 2 | Header 3 |
---|---|---|
Data 1A | Data 1B | Data 1C |
Data 2A | Data 2B | Data 2C |
Table Elements Explained:
<table>
: The container for all table content.<thead>
: Groups the header content in a table (optional but recommended for semantics).<tbody>
: Groups the body content in a table (optional but recommended for semantics).<tr>
: Defines a table row.<th>
: Defines a table header cell. By default, content is bold and centered.<td>
: Defines a standard table data cell.