Back to course

Lesson 20: Advanced Tables: Colspan, Rowspan, and Structure

The HTML Masterclass: From Zero to Web Developer

20. Advanced Tables: Colspan, Rowspan, and Structure

20.1 Structural Elements

For complex tables, use these elements to define semantic sections:

  • <thead>: Groups the header content (column titles).
  • <tbody>: Groups the primary body content (data rows).
  • <tfoot>: Groups the footer content (totals or summary).

html

MonthSales
January$500
February$750
Total$1250

20.2 Merging Cells (colspan and rowspan)

These attributes allow a single cell to span multiple columns or rows, similar to merging cells in Excel.

  • colspan: Specifies how many columns the cell should span.
  • rowspan: Specifies how many rows the cell should span.

html

Q1 Data
JanFeb