HTML <table> Tag
- The HTML
<table>
tag is used to create tabular data on a web page. - It allows you to define a table with rows and columns, and to specify properties for each table cell.
Syntax
The basic syntax for creating an HTML table is as follows:
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Row 1, Cell 1</td>
<td>Row 1, Cell 2</td>
</tr>
<tr>
<td>Row 2, Cell 1</td>
<td>Row 2, Cell 2</td>
</tr>
</table>
- The
<table>
tag identifies the start of the table. - The
<tr>
tag identifies the start of each table row. - The
<th>
tag defines a header cell in the first row of the table. - The
<td>
tag defines a standard cell in a table row.