Tell a Friend About Our Cool Software

Each row in an HTML table is defined by a <tr> tag. The height of each row is by default determined automatically as the amount of space required to hold the contents of the tallest cell in the row plus the cell padding. The one exception to this rule is if you use the height attribute in the <td> tag as described in the next section. You can control other aspects of how the row is displayed using the attributes that are described in Table
The align and bgcolor attributes of the &ly;tr>
tag are not supported in XHTML and are deprecated in HTML 4.01. You
should use styles to control alignment and background color in table rows
when you are authoring to these standards.
Table 4-2. Attributes of the <tr> tag.
| Attribute | Values | Description |
| align | right, left, center,
justify |
Determines the horizontal alignment of
text or images with the cells of the row. The default is left. |
| bgcolor | a color name, and
rgb() value, or a hex value (#xxxxxx) |
Specifies the background color of
the row. |
| valign | top, middle, bottom | Determines the vertical alignment
of content in cells of the row. The default is middle. |
Now let's see how the valign attribute works. First of all, you must realize that this attribute has an effect only if the individual cell is taller than needed to hold its content. This will happen only when the content in another cell in the same row is larger, forcing the row height to increase. Displayed in Figure 4-5 is a two column, three row table where each row uses a different valign setting. Note that the second column contains dummy content in order to make the rows taller so the valign setting will have an effect. If you omit the valign attribute the middle alignment setting is used.
|
Figure 4-5. The effects of using different valign settings in the <tr> tag.