home account info subscribe login search My ITKnowledge FAQ/help site map contact us


 
Brief Full
 Advanced
      Search
 Search Tips
To access the contents, click the chapter and section titles.

HTML 4.0 Sourcebook
(Publisher: John Wiley & Sons, Inc.)
Author(s): Ian S. Graham
ISBN: 0471257249
Publication Date: 04/01/98

Bookmark It

Search this book:
 
Previous Table of Contents Next


TR marks out a row of a table. For example, a row in a table might be coded

<TR>
    <TH> Heading </TH>  <TD> data 1 </TD>
    <TD> data2   </TD>  <TD> data3  </TD> <TD> data4  </TD>
</TR>

which indicates a row containing five columns: the first column being a table heading and the rest containing table data. Note that although the ending </TR> is optional, you should always put it in—many browsers will improperly render tables when the end tags are absent.

TR takes the same layout control attributes as COL (ALIGN, VALIGN, CHAR, and CHAROFF), and you are referred to that section for a detailed description of these attributes. In the case of TR, the layout properties apply to all cells within the defined row.


NOTE:  Internet Explorer 3 Bug

With Internet Explorer 3, ALIGN in a TR element does not properly override the default center-alignment of enclosed TH cells.


Current browsers support a number of proprietary attributes to control background coloring of the cells in a table row. These attributes are:

BACKGROUND=“#url” (optional; Internet Explorer 3 and Netscape Navigator 4 only) Specifies a background image to be used to tile the background of the row. Note that this attribute is not supported by Internet Explorer 4.
BORDERCOLOR=“#rrggbb” or “color” (optional; Internet Explorer only) Specifies the desired color for the cell border: the thinly chiseled lines drawn around the edge of each cell. This has no effect if there are no borders. This can be overridden by BORDERCOLORDARK and BORDERCOLORLIGHT, or by color specification within a given cell.
BORDERCOLORDARK=“#rrggbb” or “color” (optional; Internet Explorer only) Specifies the desired color for the darker portion of the cell border: This affects the bottom and right-hand side of the outer border of the table and the top and left-hand side of the thinly chiseled lines drawn around each cell. It has no effect if there are no borders. This attribute is overridden by color specification within a given cell.
BORDERCOLORLIGHT=“#rrggbb” or “color” (optional; Internet Explorer only) Specifies the desired color for the lighter portion of the cell border: This affects the top and left-hand side of the outer border of the table and the bottom and right-hand borders drawn around each cell. It has no effect if there are no borders. This is overridden by color specification within a given cell.

TD and TH Elements: Table Data and Table Headings

Usage: <TD> ... (</TD>)
<TH> ... (</TH>)
Can Contain: ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, DL, FIELDSET, FORM, Hn, HR, [ISINDEX], MENU, NOFRAMES, NOSCRIPT, OL, P, PRE, TABLE, UL,
characters, character highlighting, A, APPLET, BASEFONT, BR, BUTTON, IFRAME, IMG, INPUT, LABEL, MAP, OBJECT, SCRIPT, SELECT, TEXTAREA
Can Be Inside: TR
Attributes: CLASS, DIR, ID, LANG, STYLE, TITLE, standard event handlers,
ALIGN, ABBR, AXIS, BACKGROUND, BGCOLOR, CHAR, CHAROFF, COLSPAN, HEADERS, HEIGHT, NOWRAP, ROWSPAN, SCOPE, VALIGN, WIDTH, (BORDERCOLOR, BORDERCOLORDARK, BORDERCOLORLIGHT: Internet Explorer only)

TD and TH elements specify the cells in a table. The only difference between the two is their meaning: TD specifies a Table Data cell—a cell containing table data, while TH specifies Table Heading cell—a cell containing a table heading. In both cases, the element is not empty but the end tag is optional, as the end is implied by the next <TH>, <TR>, or <TD> tag. A cell can have empty content, which simply means that the cell is blank. Note that although the ending </TD> and </TH> tags are optional, you should always put them in—many browsers will improperly render tables when end tags are absent.

TD and TH elements have several attributes that define the formatting and layout of the cell and the cell content. All of these attributes are optional. In particular, the attributes ALIGN, CHAR, CHAROFF, BGCOLOR, VALIGN, and WIDTH have the same meanings as with the COL element, and you are referred to the COL element section for detailed descriptions.

Note that all cells in a table row must have the same height, while all cells in a column must have the same width; thus, if there are two WIDTH or HEIGHT specifications in the same column or row respectively, the largest value is used.


Previous Table of Contents Next


Products |  Contact Us |  About Us |  Privacy  |  Ad Info  |  Home

Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc.
All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.