| name | Carrot | Apple | Tomato |
|---|---|---|---|
| Fruits | No | Yes | It's a fruit, but it's often eaten like a vegetable |
| Vegetable | No | Yes |
Usable tags to make a table:
<caption>: the title of the table
<thead>, <tbody>, <tfoot>: represent the table's head, body, and footer.
<tr>: defines a row in the table, like a "section"
<th>: a "header cell", usually used inside <thead> or <tfoot>
<td>: a regular cell, used inside <tbody>
colspan and rowspan: these are attributes for <th> or <td> tags. They allow cells to span multiple columns or rows.
Example: <td colspan="2"></td>
code :
<table>
<caption>Fruit or Vegetable ?</caption>
<tr>
<th>name</th>
<td>Carrot</td>
<td>Apple</td>
<td>Tomato</td>
</tr>
<tr>
<th>Fruits</th>
<td>No</td>
<td>Yes</td>
<td rawspan="2">It's a fruit, but it's often eaten like a vegetable</td>
</tr>
<tr>
<th>Vegetable</th>
<td>No</td>
<td>Yes</td>
</tr>
</table>