HTML <td> Element

The <td> element defines a data cell within a row of an HTML table. Each data cell can contain text, links, images, lists, and other HTML content related to its row and column.

Syntax

<tr>
  <td>Data</td>
  <td>Data</td>
</tr>

Attributes

The <td> element supports the global HTML attributes and the following element-specific attributes:

Attribute Description
colspan Specifies how many columns the table cell should span. Its value is a positive integer.
headers Contains one or more space-separated id values identifying <th> elements that provide header information for the data cell. It can be useful for describing relationships in complex tables.
rowspan Specifies how many rows the table cell should span. A value of 0 causes the cell to extend through the remaining rows in its table row group.

Example

This example uses <td> elements for the data cells in each table row. The column headings are defined separately with <th> elements.

Play in Editor

Usage Notes

A <td> element is placed inside a <tr> element and represents a regular data cell rather than a header cell. Use <th> when a cell identifies or describes other cells in the table.

The colspan and rowspan attributes can be used when a data cell needs to extend across more than one column or row. These attributes should reflect the logical structure of the table so that rows and columns remain correctly aligned.

Accessibility

Data cells should have clear relationships with the appropriate table headers. For simple tables, correctly structured <th> elements are often enough for assistive technologies to determine these relationships. More complex tables may require the headers attribute to explicitly associate a <td> cell with one or more header cells.

Browser Support

Baseline: Widely available indicates a feature has been supported by core browsers for at least 30 months. At this stage, the feature is considered stable and safe for most websites to use without needing to worry about compatibility issues or fallbacks, as it is supported by the vast majority of users' devices and browser versions.

For detailed browser compatibility information, see Can I Use: HTML <td> Element .

The <td> element is used with other table elements, including <table>, <tbody>, <tr>, and <th>.

Specifications

The <td> element is defined in the WHATWG HTML Living Standard .