Spanning Multiple Rows or Columns

By default, a cell occupies or spans one row and one column. For most tables, this is sufficient. When you start to use tables for layout purposes, however, you'll encounter instances in which you want a cell to span more than one row or column. XHTML 1.0 supports attributes of the <th> and <td> elements that permit this effect.

Using the colspan Attribute

The colspan attribute inside a <th> or <td> element instructs the browser to make the cell defined by the element take up more than one column. You set colspan equal to the number of columns the cell is to occupy.

colspan is useful when one row of the table is forcing the table to be a certain number of columns wide, and the content in other rows can be accommodated ...

Get Platinum Edition Using XHTML™, XML, and Java™ 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.