Language References
Denotes a table data cell. | HTML 3.2, 4, 4.01, 5 |
HTML Syntax
<td
align = center | left | right
background = url
bgcolor = color
bordercolor = color
bordercolordark = color
bordercolorlight = color
class = classname
colspan = n
id = value
nowrap
rowspan = n
style = css properties
title = text
valign = baseline | bottom | center | middle | top
event = script
>
The TD element specifies a table cell which contain the table data. TD elements can only be used inside table rows, or within a TR element.
Each TD cell normally occupies only one column in one row, though authors can specify how many columns and rows the cell spans by use of the colspan and rowspan attributes.
cellspacing, or the distance between cells, and cellpadding, or the distance between the boundaries of each cell and its contents, are set at the TABLE element level. As such, all cells in a TABLE have the same padding and spacing.
A cell can be empty, that is, the TD element has no content. However, authors must still provide the TD element for any cell that is empty, so as not to collapse the table structure.
An empty cell can be made to behave like other cells in the table, having the same background color, border or other style attribute, by having a non-breaking space for its content, as in <td> </td>. If not, the space occupied by the cell will be completely empty: no content, no background color, and no border.
Although the W3C specifies that TD end tags are optional and may be omitted, it is safer to always close table data cells, as not all browsers support this recommendation, and may produce unexpected results.
TD Members
TABLE TH TR Using Tables