W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y

<TD>...</TD>

Description

The container for a cell in a table. Inside this you can put all the HTML coding you want to appear in the cell.

DTD

<!ELEMENT TD  - O (%flow;)*            -- table data cell-->
<!ATTLIST TD                           -- data cell --
  %attrs;                              -- %coreattrs, %i18n, %events --
  abbr        %Text;         #IMPLIED  -- abbreviation for header cell --
  axis        CDATA          #IMPLIED  -- names groups of related headers--
  headers     IDREFS         #IMPLIED  -- list of id's for header cells --
  scope       %Scope;        #IMPLIED  -- scope covered by header cells --
  rowspan     NUMBER         1         -- number of rows spanned by cell --
  colspan     NUMBER         1         -- number of cols spanned by cell --
  %cellhalign;                         -- horizontal alignment in cells --
  %cellvalign;                         -- vertical alignment in cells --
  >
from the HTML 4.0 DTD, "Copyright © W3C, (MIT, INRIA, Keio). All Rights Reserved."

Attributes

Core attributes: class id style title
Internationalization attributes: dir lang
Events: onclick ondblclick onmousedown onmouseup onmouseover onmousemove onmouseout onkeypress onkeydown onkeyup

W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
ABBR
With this attribute you can give an abbreviated form of the content of the cell. This abbreviation can be used by browsers when there's not enough room to show the complete contents, or by speech browsers for introduction.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
ABSHEIGHT
Use the absheight attribute to set the absolute height of the cell. There is no default value for absheight. The attribute is ignored if it isn't specified. Note that content that doesn't fit in the cell isn't visible.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
ABSWIDTH
Use the abswidth attribute to set the absolute width of the cell. There is no default value for abswidth. The attribute is ignored if it isn't specified. Note that content that doesn't fit in the cell isn't visible.
W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
ALIGN
Set the horizontal alignment of the contents of the cells in the body of the table. Possible values are :

Value Description
center The contents of table cells are centered.
char This attribute defines that the contents of table cells must be centered around a certain character. Which character this is, is defined with the char attribute.

If no char attribute is given, a default character is used. This is the character that is defined to represent the decimal point in the current language. In English this is the period ("."), in Dutch it is the comma (",").

This value is not supported by the HTML 3.2 standard.

justify The contents of table cells is evenly spread between the left and right border of a table cell. This is achieved by enlarging the space between each word on a line.

This value is not supported by WebTV.

left The contents of table cells are aligned to the left side.
right The contents of table cells are aligned to the right side.


W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
AXIS
Using the axis attribute the browser is capable of creating categories of data. With these categories you can query the table for cells that belong to one or more categories. The results of these queries are the contents of the cells that satisfy the conditions stated in the query.

The axis attribute is used to give a category a name, and the contents of the cell is the value for that category. The next thing to do is give each category a unique id with the id attribute.

After categories have been defined you must tell which data cells belong to that category. You do this by using the headers attribute, which you give the id value of the category to which it belongs.

Note: At this moment, there's no defined way of requesting a query, or how to show the results of the query. You must supply the value as a list of values, separated by commas.


W3 3.2n
4.0n
NS 3.0n
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
BACKGROUND
Supply an image that is used as the background of the cell. If the cell is larger than the image the image is tiled to fill up the used space. You can use images in the GIF and JPEG format.
If you use an transparent image the transparent parts will be shown in the background image or background color of the table.
W3 3.2n
4.0d
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
BGCOLOR
Set the background color of the cell. This color overrules background colors set with the TABLE and TR elements.

This attribute can be used in conjunction with the GRADCOLOR attribute, which sets the ending color for the background gradient.
See the page Using colors for a description on specifying colors.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0y
4.0y
TV 1.2n
2.1n
BORDERCOLORLIGHT
Sets the color of one of the two colors used to draw a 3-D border around the cell, the other is set with BORDERCOLORDARK. This attribute only has effect if the table has a border. This value overrules a color set at the table or row level.
See the page Using colors for a description on specifying colors.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0y
4.0y
TV 1.2n
2.1n
BORDERCOLORDARK
Sets the color of one of the two colors used to draw a 3-D border around the cell, the other is set with BORDERCOLORLIGHT. This attribute only has effect if the table has a border. This value overrules a color set at the table or row level.
See the page Using colors for a description on specifying colors.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
CHAR
When you specify align="char", this attribute specifies which character must be used to center the text around.

When more than one occurrence of the character is present, the first occurrence is used.


W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
CHAROFF
This attribute specifies an offset that must be used when align="char" is used. The value can be specified as a number of pixels, or as a percentage of the current width.

This offset is added to the position where the character to center around is. The direction of the offset depends on the current direction of the text.

When the alignment character isn't present in the line, the text is shifted, so that the text ends at the offset.


W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
COLSPAN
Define the number of columns this cell must span. The default is 1.

The value "0" is a special value and means that this column spans from this column to the last column in the table.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1y
GRADANGLE
Defines the gradient angle of a table cell. Values range from 90 to -90 degrees.
gradangle="0" creates a simple left-to-right gradient.
gradangle="90" creates a top-to-bottom gradient.
W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1y
GRADCOLOR
Defines the ending color for a background gradient in a table cell. Colors can be specified either as hexadecimal color values or as predefined color names. This attribute must be used in conjunction with the BGCOLOR attribute, which sets the starting color for the background gradient.
See the page Using colors for a description on specifying colors.
W3 3.2y
4.0d
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
HEIGHT
Set the height of the cell in pixels.
W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
HEADERS
This attribute can provide a reference to one or more header cells in the table that contain header information about the data cell. You can use this attribute to help speech-browsers in rendering the document.

Another use of this attribute is to tell the browser to which category the cell belongs. Categories are defined with the axis attribute.

The value of this attribute is a list of id values of header cells, separated by spaces.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1n
MAXLINES
Use the maxlines attribute to set the maximum number of lines to display in the cell. There is no default value for maxlines. The attribute is ignored if it isn't specified. Note that content that doesn't fit in the cell isn't visible.
W3 3.2y
4.0d
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2n
2.1n
NOWRAP
Using this attribute assures the automatic layout system of the table will not wrap the contents of this cell, if necessary. Watch out for very wide cells, which will cause the table to be wider than the width of the window, because the user will have to scroll to see the contents of the cells.
You do not need to specify a value for this attribute.
W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
ROWSPAN
Define the number of rows this cell must span. The default is 1.

The value "0" is a special value and means that this row spans from this row to the last row in the table.


W3 3.2n
4.0y
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2n
2.1n
SCOPE
This attribute designates the cell as the cell that contains header information about a set of cells. Which set of cells belong to this group is defined with the following values:

Possible values of the scope attribute
Value Description
COL The cell contains header information for all the cells in the same column as this cell.
COLGROUP The cell contains header information for all the cells in the same column group as this cell.
Column groups are created with the COLGROUP and COL elements.
ROW The cell contains header information for all the cells in the same row as this cell.
ROWGROUP The cell contains header information for all the cells in the same row group as this cell.
Row groups are created with the THEAD, TFOOT and TBODY elements.

This attribute is an equivalent of the headers attribute, but easier to use, specially for tables that don't have a complex structure.


W3 3.2n
4.0n
NS 3.0n
4.0n
IE 3.0n
4.0n
TV 1.2y
2.1y
TRANSPARENCY
With version 1.1 of the WebTV interface, use the transparency attribute for the background color for cells in a row. The value for the transparency attribute can range from 0 (fully opaque) to 100 (fully transparent). The default value for transparency is 0. Note that the WebTV interface has implemented optimizations for a transparency value of 50 that make pages draw faster.
W3 3.2y
4.0y
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
VALIGN
Set the vertical alignment of the contents of the cells in the table body. Possible values are :

Value Description
baseline The first line of the contents of the cell are aligned with a common baseline.
bottom The text in each cell in the column is aligned at the bottom of the cell.
middle The text is centered vertically in each cell.
top The text in each cell is aligned at the top of the cell.


W3 3.2y
4.0d
NS 3.0y
4.0y
IE 3.0y
4.0y
TV 1.2y
2.1y
WIDTH
Set the width of the cell in pixels or as a percentage of the width of the table, but only if the width of the table is specified with the <TABLE> element.

Examples

Source
<TABLE width="100%" border>
<TR>
<TD align="right" valign="bottom" bgcolor="#ffdfdf" height="100">
<SPAN style="color: #000">This text is in the lower right corner of the cell</SPAN>
</TD>
<TD align="center" valign="middle" bgcolor="#dfdfff">
<SPAN style="color: #000">This text is centered in the cell</SPAN>
</TD>
<TD rowspan="2" width="15%" background="background.gif" bgcolor="#500000">
<FONT color="#ffff00">This cell spans 2 rows</FONT></TD>
</TR>
<TR>
<TD colspan="2" align="center">This cell spans 2 columns</TD>
</TR>
</TABLE>
 
Result
This text is in the lower right corner of the cell This text is centered in the cell This cell spans 2 rows
This cell spans 2 columns
Statistics