HTML Tables
- HTML tables are used to display data in rows and columns
- Tables are created using <table> tag
- Rows are defined using <tr>
- Table headers use <th>
- Table data cells use <td>
Why HTML Tables are Important?
HTML tables help organize structured data like reports, schedules, pricing lists, and user data in a clean and readable format.
Basic HTML Table Structure
Example
<table>
<tr>
<th>Name</th>
<th>Age</th>
<th>City</th>
</tr>
<tr>
<td>Shivam</td>
<td>22</td>
<td>Delhi</td>
</tr>
<tr>
<td>Aman</td>
<td>25</td>
<td>Mumbai</td>
</tr>
</table>
Result
| Name | Age | City |
|---|---|---|
| Shivam | 22 | Delhi |
| Aman | 25 | Mumbai |
HTML Table Tags Explained
<table>
Defines the entire table structure.
<tr>
Defines a table row.
<th>
Defines a header cell (bold & centered).
<td>
Defines a standard data cell.
Table with Border Example
Example
<table border="1">
<tr>
<th>Product</th>
<th>Price</th>
</tr>
<tr>
<td>Laptop</td>
<td>50000</td>
</tr>
</table>
Types of HTML Table Content
Header Row
Defines column titles using <th>.
Data Rows
Contains actual information using <td>.
Structured Data
Used for reports, schedules, and listings.
SEO Benefits of HTML Tables
✔ SEO Advantage:
Proper table structure helps search engines understand data better, improves readability, and enhances structured content visibility.
Key Takeaways
- Use <table> for structured data
- Use <tr> for rows
- Use <th> for headers
- Use <td> for data cells
- Tables are useful for reports and lists