HTML and CSS Reference
In-Depth Information
To create a cell that spans multiple rows or columns, you add the rowspan or colspan
attribute to the <th> or <td> elements, along with the number of rows or columns you
want the cell to span. The data within that cell then fills the entire width or length of the
combined cells, as in the following example:
Input
<!DOCTYPE html>
<html>
<head>
<title> Row and Column Spans </title>
</head>
<body>
<table border=“1” summary=“span example”>
<tr>
<th colspan=“2”> Gender </th>
</tr>
<tr>
<th> Male </th>
<th> Female </th>
</tr>
<tr>
<td> 15 </td>
<td> 23 </td>
</tr>
</table>
</body>
</html>
Figure 10.22 shows how this table might appear when displayed.
.
Output
FIGURE 10.22
Using span
settings to widen
a column.
Note that if a cell spans multiple rows, you don't have to redefine it as empty in the next
row or rows. Just ignore it and move to the next cell in the row. The span fills in the spot
for you.
 
 
Search WWH ::




Custom Search