HTML and CSS Reference
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.
There are no required attributes for the tr element.
Aside from the global attributes, there are no additional attributes for the tr element.
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
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