HTML and CSS Reference
In-Depth Information
<th>Phone</th>
<th>E-mail</th>
</tr>
<tr>
<td>Jack</td>
<td>5/13</td>
<td>857-555-5555</td>
<td>jack04521@gmail.com</td>
</tr>
<tr
bgcolor="#CCCCCC"
>
<td>Sparky</td>
<td>11/28</td>
<td>303-555-5555</td>
<td>sparky@iname.com</td>
</tr>
</table>
FAQ
What if I want a more interesting table?
You can alter the gridlike look of a table by applying the
colspan
and
rowspan
attributes to
<td>
elements. As you get into more complex table configurations like these, be sure to
sketch the table on paper before you start typing the XHTML code.
The
colspan
Attribute.
This attribute specifies the number of columns that a cell
will occupy. Figure 8.14 shows a row that spans two columns.
Figure 8.14
Table with a row that
spans two columns
The XHTML code for the table follows:
<table border="1">
<tr>
<td
colspan="2"
>This spans two columns</td>
</tr>
<tr>
<td>Column 1</td>
<td>Column 2</td>
</tr>
</table>
The
rowspan
Attribute.
This attribute specifies the number of rows that a cell will
occupy. An example of a column that spans two rows is shown in Figure 8.15.
Figure 8.15
Table with a column
that spans two rows
Search WWH ::
Custom Search