colspan and rowspan for Spanning
Merge cells across columns and rows.
What Is Cell Spanning?
By default, each table cell occupies one row and one column. Spanning allows a cell to stretch across multiple columns or rows:
colspan— span multiple columns- rowspan — span multiple rows
colspan
The colspan attribute makes a cell span multiple columns:
<table>
<tr>
<th colspan="3">2024 Quarterly Sales</th>
</tr>
<tr>
<th>Q1</th>
<th>Q2</th>
<th>Q3</th>
</tr>
<tr>
<td>$10k</td>
<td>$12k</td>
<td>$15k</td>
</tr>
</table>All lessons in this course
- table tr td and th
- thead tbody tfoot Structure
- colspan and rowspan for Spanning
- Table Accessibility scope summary caption