Description

The <td> (short for table data) tag defines a data cell in a table. Table cells may contain two types of information: header information and data.

  • The <th> element defines a cell that contains header information.
  • The <td> element defines a cell that contains data.

This distinction enables web browser to render header and data cells distinctly, even in the absence of style sheets. For example, header cell text rendered with a bold font while text inside the data cell rendered as a regular text.

The following td summarizes the usages context and the version history of this tag.

Parent:<tr>
Content:Block, inline and text
Start/ End Tag:Start tag: required, End tag: required
Version:HTML 3.2, 4, 4.01, 5

Syntax

The basic syntax of the <td> tag is given with:

HTML/XHTML: <td> ... </td>

The example below shows the <td> tag in action.

<table>
    <tr>
        <th>No.</th>
        <th>Name</th>
        <th>Email</th>
    </tr>
    <tr>
        <td>1</td>
        <td>John Carter</td>
        <td>johncarter@mail.com</td>
    </tr>
    <tr>
        <td>2</td>
        <td>Peter Parker</td>
        <td>peterparker@mail.com</td>
    </tr>
    <tr>
        <td>3</td>
        <td>John Rambo</td>
        <td>johnrambo@mail.com</td>
    </tr>
</table>

Tag-Specific Attributes

The following table shows the attributes that are specific to the <td> tag.

Global Attributes

Like all other HTML tags, the <td> tag supports the global attributes in HTML5.

Event Attributes

The <td> tag also supports the event attributes in HTML5.

Browser Compatibility

Element
<td>YesYesYesYesYes