HTML and CSS Reference
In-Depth Information
Defining a Table Structure
• To mark a Web table, enter
<table>
rows
</table>
where
rows
are the rows of the table.
• To mark a table row, enter
<tr>
cells
</tr>
where
cells
are the table cells contained within the row.
• To mark a cell containing a row or column heading, enter
<th>
content
</th>
where
content
is the content of the heading.
• To mark a cell containing table data, enter
<td>
content
</td>
where
content
is the content of the table data.
Kyle's proposed Web table from Figure 5-2 contains 10 rows; the fi rst row contains the
days of the week, and the nine rows that follow list the KPAF shows from 6:00 p.m. to
10:30 p.m. in half-hour intervals. For now, you'll insert
tr
elements for just the fi rst three
rows of the table. You'll also include a class attribute, placing the table in the
schedule
class of elements to distinguish it from other tables on the KPAF Web site.
To insert the Web table:
◗
1.
Return to the
schedule.htm
file in your text editor.
◗
2.
Directly above the closing
</section>
tag, insert the following code, as shown in
Figure 5-3:
<table class=”schedule”>
<tr>
</tr>
<tr>
</tr>
<tr>
</tr>
</table>
Figure 5-3
Marking a table and table rows
table element marking
the Web table
table rows