Skip to main content

HTML Table Colspan & Rowspan

Table cells can span over more than one row and/or column.


HTML Table - Colspan

To make a cell span several columns, use the colspan attribute.

Note: The value of colspan is the number of columns to span.

Example

A header cell that spans two columns.

Prompt
A table where a Name header spans two columns using colspan=2, plus an Age header, then two data rows (Jill Smith 43, Eve Jackson 57).
Output: complete HTML page

HTML Table - Rowspan

To make a cell span several rows, use the rowspan attribute.

Note: The value of rowspan is the number of rows to span.

Example

A cell that spans two rows.

Prompt
A table where a Phone header spans two rows using rowspan=2, with a Name row (Jill) and two phone numbers (555-1234 and 555-8745).
Output: complete HTML page