19. Creating Basic Data Tables (<table>)
Tables are used to display tabular data (not for layout, which is what CSS is for). A basic table requires three core elements.
19.1 Basic Table Structure
<table>: The container for the entire table.<tr>: Table Row.<td>: Table Data Cell (standard cell).
html
<table> <tr> <td>Cell 1, Row 1</td> <td>Cell 2, Row 1</td> </tr> <tr> <td>Cell 1, Row 2</td> <td>Cell 2, Row 2</td> </tr> </table>19.2 Table Headers (<th>)
Table Header cells (<th>) are used to label the columns or rows. They are typically rendered bold and centered by default, and provide semantic meaning.
html
<table> <tr> <th>Name</th> <th>Age</th> <th>City</th> </tr> <tr> <td>Alice</td> <td>30</td> <td>New York</td> </tr> </table>