<td> (Table Data)
This element specifies a data cell in a table. The element should occur within a table row as defined by the <tr> element.
align="center | justify | left | right"
bgcolor="color name | #RRGGBB" (transitional only)
colspan="number of columns to span"
dir="ltr | rtl"
headers="space-separated list of associated header cells' id values"
height="pixels or percentage" (transitional only)
id="unique alphanumeric identifier"
nowrap="nowrap" (transitional only)
rowspan="number or rows to span"
scope="col | colgroup | row | rowgroup"
valign="baseline | bottom | middle | top"
width="pixels or percentage" (transitional only)
Nonstandard Attributes Commonly Supported
background="url of image file"
bordercolor="color name | #RRGGBB"
Attributes Defined by Internet Explorer
background="url of image file" (4)
bordercolor="color name | #RRGGBB" (4)
bordercolordark="color name | #RRGGBB" (4)
bordercolorlight="color name | #RRGGBB" (4)
hidefocus="true | false" (5.5)
unselectable="on | off" (5.5)
Standard Event Attributes
onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup
Events Defined by Internet Explorer
onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfilterchange, onfocus, onfocusin, onfocusout, onhelp, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresizeend, onresizestart, onselectstart, ontimeerror
Element Specific Attributes
- The value of this attribute is an abbreviated name for a header cell. This might be useful when attempting to display large tables on small screens.
- This attribute is used to align the contents of the cells. Supported values are center, justify, left, and right.
- This attribute is used to provide a name for a group of related headers.
- This nonstandard attribute, which is supported by Internet Explorer, Netscape and WebTV, specifies the URL of a background image for the table cell. The image is tiled if it is smaller than the cell's dimensions.
- This attribute specifies a background color for a table cell. Its value can be either a named color, such as red, or a color specified in the hexadecimal #RRGGBB format, such as #FF0000. (Netscape Navigator often fails to render a cell with a colored background unless a nonbreaking space, at least, is inserted in the cell.)
- This attribute, supported by Internet Explorer and Netscape, is used to set the border color for a table cell. The attribute should be used only with a positive value for the border attribute. The value of the attribute can be either a named color, such as green, or a color specified in the hexadecimal #RRGGBB format, such as #00FF00.
- This Internet Explorer-specific attribute specifies the darker of two border colors used to create a three-dimensional effect for a cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such as blue, or a color specified in the hexadecimal #RRGGBB format, such as #00FF00.
- This Internet Explorer-specific attribute specifies the lighter of two border colors used to create a three-dimensional effect for a cell's borders. It must be used with the border attribute set to a positive value. The attribute value can be either a named color, such as red, or a color specified in the hexadecimal #RRGGBB format, such as #FF0000.
- This attribute is used to define the character to which element contents are aligned when the align attribute is set to the char value.
- This attribute contains an offset as a positive or negative integer to align characters as related to the char value. A value of 2, for example, would align characters in a cell two characters to the right of the character defined by the char attribute.
- This attribute takes a numeric value that indicates how many columns wide a cell should be. This is useful to create tables with cells of different widths.
- This attribute takes a space-separated list of id values that correspond to the header cells related to this cell.
- This attribute indicates the height of the cell in pixels.
- This attribute keeps the content within a table cell from automatically wrapping.
- This attribute takes a numeric value that indicates how many rows high a table cell should span. This attribute is useful in defining tables with cells of different heights.
- This attribute specifies the table cells that the current cell provides header information for. A value of col indicates that the cell is a header for the the rest of the column below it. A value of colgroup indicates that the cell is a header for its current column group. A value of row indicates that that the cell contains header information for the rest of the row it is in. A value of rowgroup indicates that the cell is a header for its row group. This attribute might be used in place of the header attribute and is useful for rendering assistance by nonvisual browsers. This attribute was added very late to the HTML 4 specification so support for this attribute is minimal.
- This attribute is used to set the vertical alignment for the table cell. HTML 4 defines baseline, bottom, middle, and top. Internet Explorer replaces middle with center; the effect should be the same.
- This attribute specifies the width of a cell in pixels.
<td align="left" valign="top">
Put me in the top left corner.</td>
<td align="right" bgcolor="red" valign="bottom">
Put me in the bottom right corner.</td>
<table border="1" width="80%">
A pretty wide cell</td>
HTML 3.2, 4, 4.1, XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1.1, 2, 3, 4, 4.5-4.8, 6, 7
Under the XHTML 1.0 specification, the closing </td> tag ceases to be optional.
The HTML 3.2 specification defines only align, colspan, height, nowrap, rowspan, valign, and width attributes.
This element should always be within the <tr> element.