HTML Tables are a way to display data in a structured format on a web page. A table consists of rows and columns where the intersection of a row and a column is called a cell.
To create a table in HTML, you need to use the <table> tag to define the table and then use additional tags to specify the table’s structure.
Here is an example of a basic table structure in HTML:
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
In the example above, the <table> tag is used to define the table. The <tr> tags are used to define each row of the table, and the <th> and <td> tags are used to define the cells in each row. The <th> tag is used for header cells, while the <td> tag is used for regular cells.
You can also add additional attributes to the <table>, <tr>, <th>, and <td> tags to specify things like the width and height of cells, background colors, borders, and more.
HTML tables can be useful for organizing and presenting data in a clear and structured manner on a web page. However, it’s important to use them appropriately and avoid using tables for layout purposes, as this can negatively impact accessibility and SEO.
