Tables in HTML are used to display data in a structured format using rows and columns—like a spreadsheet or data grid. This is helpful for showing schedules, price lists, results, or any information that fits a tabular form.
<table>
<tr>
<th>Heading 1</th>
<th>Heading 2</th>
</tr>
<tr>
<td>Row 1, Col 1</td>
<td>Row 1, Col 2</td>
</tr>
</table>
| Tag | Meaning | Use |
|---|---|---|
| <table> | Table element | Wraps the entire table |
| <tr> | Table Row | Defines a row in the table |
| <th> | Table Header | Defines a heading cell |
| <td> | Table Data | Defines a normal data cell |
| Name | Math | Science | English |
|---|---|---|---|
| Ali | 85 | 90 | 88 |
| Zara | 78 | 95 | 82 |
<td colspan="2">Merged Cell</td>
<td rowspan="2">Merged Cell</td>
| Name | Scores | |
|---|---|---|
| Ana | 95 | 88 |
Create a table showing your 3 favorite fruits, their color, and taste.
Make a table with days of the week as headers and activities in each row.
Create a pricing table where one cell spans across two columns or rows.