In HTML tables, all table rows must span the same number of columns and all table columns must span the same number of rows. Consider the following table, which has two rows:
Note that the second table row has only two cells; however, it spans all three columns. In HTML, this is accomplished by adding a
colspan attribute to any table cell that spans more than one column. The following code would create a table like the one above.
Spanning rows works in the same way:
Note that the second table column has only one cell; however, it spans both rows. This is accomplished with the
rowspan attribute as shown in the code below.