HTML and CSS Reference
In-Depth Information
Throughout this chapter, we'll make mention of rules regarding tag omissions you can take advantage of
when coding tables. However, tables can become very complex once you start dealing with large numbers
of rows and columns, so we recommend including both start and end tags whenever possible. You'll find
the resulting markup easier to read and less prone to errors of omission. For all remaining examples in this
chapter, we'll include both start and end tags while making note of opportunities for tag omissions.
Required Attributes
There are no required attributes for the tr element.
Optional Attributes
Aside from the global attributes, there are no additional attributes for the tr element.
td
The td element, the workhorse of any HTML table, represents an individual cell in a data table. The
element's name, which is short for “table data,” gives you an indication of its expected content. Listing 7-4
marks up a table with a single row and a single cell.
Listing 7-4. A simple table with a single row and a single cell
<table>
<tr>
<td>Utility Belts</td>
</tr>
</table>
The example in Listing 7-4, a table with a single row and a single cell, is technically valid but doesn't really
represent tabular data. A proper table consists of multiple rows containing multiple cells of information that
relate to one another in some fashion. Listing 7-5 expands on the previous example by adding several
rows and cells to the table.
Listing 7-5. A table with three rows, each with two cells
<table>
<tr>
<td>Utility Belts</td>
<td>9</td>
</tr>
<tr>
<td>Grappling Hooks</td>
<td>27</td>
</tr>
<tr>
<td>Smoke Pellets</td>
<td>623</td>
</tr>
</table>
 
Search WWH ::




Custom Search