Chapter 6 of 10
Tables are for tabular data โ information that belongs in rows and columns. They're commonly misused for layout (don't do that โ that's what CSS Grid and Flexbox are for).
<table>
<thead>
<tr>
<th>Language</th>
<th>Type</th>
<th>Used for</th>
</tr>
</thead>
<tbody>
<tr>
<td>JavaScript</td>
<td>Frontend + Backend</td>
<td>Interactivity, servers, APIs</td>
</tr>
<tr>
<td>Python</td>
<td>Backend</td>
<td>Scripting, AI, web apps</td>
</tr>
<tr>
<td>HTML</td>
<td>Markup</td>
<td>Page structure</td>
</tr>
</tbody>
</table><table> โ the container for the entire table<thead> โ groups the header rows (optional but good practice)<tbody> โ groups the data rows<tr> โ table row (contains cells)<th> โ table header cell (bold, centred by default)<td> โ table data cell (regular content)<table>
<tr>
<td colspan="2">This cell spans 2 columns</td>
<td>Normal cell</td>
</tr>
<tr>
<td rowspan="2">This cell spans 2 rows</td>
<td>Cell 2</td>
<td>Cell 3</td>
</tr>
<tr>
<td>Cell 4</td>
<td>Cell 5</td>
</tr>
</table>WARNING
Tables are NOT for layout. Before CSS was widely supported, developers used tables to create page layouts (columns, grids, etc.). That technique is completely obsolete. Never use tables for layout โ only use them for actual tabular data like schedules, comparison charts, and pricing tables.