HTML Table Rowspan And Colspan

What does colspan do?

Allows a single table cell to span the width of more than one cell or column.

What does rowspan do?

Allows a single table cell to span the height of more than one cell or row.

Why use colspan or rowspan?

Sometimes it makes sense for a cell to span multiple columns or multiple rows. This might be used for a header cell that titles a group of columns, or a side-bar that groups rows of entries.
Both colspan= and rowspan= are attributes of the two table-cell elements, <th> and <td>. They provide the same functionality as “merge cell” in spreadsheet programs like Excel.

The value of either attribute must be a positive integer (a whole number). The value specifies the number of columns or rows that the cell fills.

colspan Code Examples

Using colspan for multi-column headings

Using colspan for single-row titling

rowspan Code Example