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
XHTML Table Headings
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">
<th> Name </th>
<th> Birthday </th>
<th> Phone </th>
<th> E-mail </th>
XHTML Table Captions
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