<TD> Tag & its Attribute
HTML Tag <TD>
<TD> Contains a table cell. These tags go inside the <TR> tags.
Attribute of <TD> Tag
- ALIGN
- AXES
- AXIS
- BACKGROUND
- BGCOLOR
- BORDERCOLOR
- BORDERCOLORDARK
- CHAR
- CHAROFF
- CLASS
- COLSPAN
- ID
- NOWRAP
- ROWSPAN
- STYLE
- TITLE
- VALIGN
- WIDTH
ALIGN
Specifies how text within the table header will line up with the edges of the table cells, or if ALIGN=CHAR, on a specific character (the decimal point).
<TR>
<TD><B>Television</B></TD>
<TD>
<IMG SRC="logo.gif" ALT="logo" BORDER=0>
</TD>
</TR>
Possible Values
LEFT, RIGHT, CENTER, JUSTIFY, CHAR
AXES
Lists AXIS values that pertain to the cell.
<TD AXES="Tutorial subject"><B>Subject</B></TD>
Possible Values
Any Name
AXIS
Specifies an abbreviated cell name.
<TD AXIS="sub"><B>Tutorial Subject</B></TD>
Possible Values
Any Name
BACKGROUND
Specifies the relative or absolute location of a graphic image file for the browser to load as a background graphic for the table cell.
<TD BACKGROUND="waves.gif">
Possible Values
URL
BGCOLOR
Specifies the background color inside a table cell. You can substitute the hexadecimal RGB values for the appropriate color names.
<TR><TD BGCOLOR="Pink">Course Number</TD>
<TD BGCOLOR="Blue">Time taught</TD></TR>
Possible Values
Color Name or hexadecimal color code.
BORDERCOLOR
Indicates the color of the border of the table cell. You can specify the color with hexadecimal RGB values or by the color name.
<TR><TD BORDERCOLOR="Blue">
Possible Values
Color Name or hexadecimal color code.
BORDERCOLORDARK
Indicates the darker color used to form 3-D borders around the table cell. You can specify the color with its hexadecimal RGB values or with its color name.
<TD BORDERCOLORLIGHT=#FFFFFF
BORDERCOLORDARK=#88AA2C>
Possible Values
Color Name or hexadecimal color code.
CHAR
Specifies the character on which cell contents will align, if ALIGN="CHAR". If you omit CHAR=, the default value is the decimal point in the specified language.
<TD ALIGN="CHAR" CHAR=",">
Possible Values
Any character
CHAROFF
Specifies the number of characters from the left at which the alignment character appears.
<TD ALIGN="CHAR" CHAR="," CHAROFF="7">
Possible Values
Any Integer Number.
CLASS
Indicates which style class applies to the <TD> element.
<TD CLASS="dkm">Welcome to cs-tutorial.com</TD>
Possible Values
Any Class Name.
COLSPAN
Specifies that a table cell occupy one column more than the default of one. This is useful when you have a category name that applies to more than one column of data.
<TR><TD COLSPAN=2>Students</TD></TR>
<TR><TD>Dinesh</TD>
<TD>Kumar</TD>
</TR>
Possible Values
Integer Number.
ID
Assigns a unique ID selector to an instance of the <TD> tag. When you then assign a style to that ID selector, it affects only that one instance of the <TD> tag.
<TD ID="dkm">
Possible Values
Any ID Name.
NOWRAP
Disables the default word-wrapping within a table cell, thus maximizing the amount of the cell’s horizontal space.
<TD NOWRAP>TWelcome to Cs-Tutorial.com</TD>
Possible Values
NOWRAP
ROWSPAN
Specifies that a table cell occupy more rows than the default of 1. This is useful when several rows of information are related to one category.
<TR><TD VALIGN=MIDDLE ALIGN=RIGHT
ROWSPAN=3>WEB Tutorial Subjects </TD>
<TD>PHP</TD>
<TD>JSP</TD></TR>
<TR><TD>javascrip</TD></TR>
Possible Values
Number of rows.
STYLE
Specifies Style Sheet commands that apply to the contents of the table cell.
<TD STYLE="background: red">
Possible Values
CSS Property with value.
TITLE
Specifies text assigned to the tag. You might use this attribute for context-sensitive help within the document. Browsers may use this to show tool tips over the table header.
<TD TITLE="Table Cell Heading">
Possible Values
Any text Message.
VALIGN
Aligns the contents of a cell with the top, bottom, baseline, or middle of the cell.
<TD VALIGN=TOP><IMG SRC="images/bud.gif"
BORDER=0></TD>
Possible Values
TOP, MIDDLE, BOTTOM, BASELINE
WIDTH
Specifies the horizontal dimension of the cell in pixels or as a percentage of the table width.
<TD WIDTH=200 ALIGN=LEFT><H2>CS- Tutorial </H2></TD>
Possible Values
Value in Pixel.