ptg16476052
284 LESSON 10: Building Tables
Tag Use
<tr>...</tr> Defines a table row, which can contain heading and data
cells.
<th>...</th> Defines a table cell that contains a heading. Heading cells
are usually indicated by boldface and centered both horizon-
tally and vertically within the cell.
<td>...</td> Defines a table cell containing data. Table cells are in a
regular font and are left-aligned and vertically centered within
the cell.
Because several of the table attributes apply to more than one of the preceding elements,
I’m listing them separately. Table 10.2 presents a quick summary of the HTML attributes
you learned about in this lesson that remain current in HTML5.
TABLE 10.2 Current HTML5 Table Attributes
Attribute Applied to Element Use
border <table> Indicates whether the table will be drawn with a border.
The default is no border. If border has a value, it’s the
width of the shaded border around the table. This attribute
is nonconforming in HTML5.
span <colgroup> Defines the number of columns in a column group. Must
be an integer greater than 0.
<col> Defines the number of columns that a cell spans. Must be
an integer greater than 0.
colspan <th> or <td> Indicates the number of cells to the right of this one that
this cell will span.
rowspan <th> or <td> Indicates the number of cells below this one that this cell
will span.
Workshop
This lesson covered one of the more complex subjects in HTML: tables. Before you
move on to the next lesson, work through the following questions and exercises to make
sure that you’ve really got a good grasp of how tables work.