Website Magazine

Tables in HTML - Part Two

To merge several cells into one, you need to create what is called a spanning cell, which just happens to be a cell that spans more than one row or column in a table. To span a column or td, we use colspan. To span more than one row or tr, we use rowspan. The basic syntax for the colspan attribute is:

<td colspan=”2″>

When you create your tables you should always have an equal number of columns and colspan allows you to do just that.

The basic syntax for the rowspan attribute is:

<tr rowspan=”2″>

HTML Table Example

This example shows HTML tables using colspan,rowspan, and nested tables. Please view table example code here.

Date 8:00AM 2:00PM 8:00PM
12 January $1.32 $1.48 $1.64
19 January $1.29 $1.51 $1.59
26 January $1.37 $1.46 $1.61

Date 8:00AM 2:00PM 8:00PM
12 January 1.32 1.48 1.64
19 January 1.29 1.51 1.59
26 January 1.37 1.46 1.61

Date 8:00AM 2:00PM 8:00PM

Filed under: HTML

Comments are closed.