HTML and CSS Reference
In-Depth Information
Notice how the table is described row by row. Also, each row is described cell by cell.
This attention to detail is crucial to the successful use of tables.
What if you don't want a border on your table? The
border
attribute
is optional. The
table shown in Figure 8.1 uses a border with its width set to
1
. If you omit the
border
attribute, the table displays with no visible border. Figure 8.2 shows the same table with
the
border
attribute omitted.
Figure 8.2
Table with no visible
border
The
<th>
, or table heading, element can be used to distinguish column headings from
table content. Figure 8.3 shows a table that uses the
<th>
element.
Figure 8.3
Using
<th>
tags on
a table
The XHTML for the table shown in Figure 8.3 is shown below. Notice that the first
row uses
<th>
instead of
<td>
tags.
<table border="1">
<tr>
<th>
Name
</th>
<th>
Birthday
</th>
<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>
<td>Sparky</td>
<td>11/28</td>
<td>303-555-5555</td>
<td>sparky@iname.com</td>
</tr>
</table>
The
<caption>
element is often used with a data table to describe its contents. The
table shown in Figure 8.4 uses
<caption>
tags to set the caption to Birthday List.
Search WWH ::
Custom Search