HTML and CSS Reference
In-Depth Information
Cells always span downward and to the right. To create a cell that spans several columns,
you add the
colspan
attribute to the leftmost cell in the span. For cells that span rows,
you add
rowspan
to the topmost cell.
The following input and output example shows a cell that spans multiple rows (the cell
with the word
Piston
in it). Figure 10.23 shows the result.
Input
▼
<!DOCTYPE html>
<html>
<head>
<title>
Ring Clearance
</title>
</head>
<body>
<table border=“1” summary=“ring clearance”>
<tr>
<th colspan=“2”> </th>
<th>
Ring
<br />
Clearance
</th>
10
</tr>
<tr align=“center”>
<th rowspan=“2”>
Piston
</th>
<th>
Upper
</th>
<td>
3mm
</td>
</tr>
<tr align=“center”>
<th>
Lower
</th>
<td>
3.2mm
</td>
</tr>
</table>
</body>
</html>
.
Output
FIGURE 10.23
Cells that span
multiple rows and
columns.