Skip to: content, navigation

by Ian Lloyd

td (HTML element)

Spec
Depr. Empty Version
No No HTML 2
Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Full Full Full Full

Example

These td elements are used in a two-column row:

<tr>
  <td>Smart</td>
  <td>From 2%</td>
</tr>
Type
table element
Contains
block-level elements, inline elements
Contained by
tr

Description

You can use two kinds of cells in a table: the th element is reserved for cells that contain header information, but the td can be used for any kind of data. Aside from that difference of usage and meaning (and the default presentational differences—th text is bold and centered while td text is non-bold and left-aligned), in almost every other way, the td element behaves, and has the same attributes, as the th element.

The axis and scope attributes can also be used in td elements, and this is a perfectly valid use of HTML, but you’re advised to reserve your usage of these attributes to table headers only. However, the headers and id are almost certainly going to be used in td elements for the purpose of creating relationships between the td content and the header cells.

Finally, this element uses the colspan and rowspan attributes when the content of the cell needs to run across multiple columns or rows.

Use This For …

The td is used for content in a table that represents standard data (that’s to say, it’s not a header cell, and most likely falls under a column or row header).

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

It causes no compatibility issues, and has excellent support across all tested browsers.

In this Section

Related Reading

User-contributed notes

ID:
#1
Date:
Fri, 28 Mar 2008 12:54:51 GMT
Contributed by:
AutisticCuckoo

'However, the headers and id are almost certainly going to be used in td elements for the purpose of creating relationships between the td content and the header cells.'

The HEADERS attribute will occur in the TD, but the corresponding ID attributes would normally be found in TH elements.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters