<td> tag

HTML <td> tag

The <td> tag describes a cell containing data within the table of the HTML document.

This cell contains the actual data under a particular header(<th> tag).

If you need to code the <td> tag, it must be present inside the <tr> tag.

The <tr> tag defines a single row.

Syntax:

<tr>
      <td> text1</td>
      <td> text2</td>
       …..
      <td> textn </td>
</tr>

Example

<table>
   <tr>
     <th>BIG DATA </th>
     <th>DIGITAL MARKETING</th>
     <th>MAINFRAME </th>
   </tr>
   <tr>
     <td>Scala</td>
     <td>Social Media</td>
     <td>DB2</td>
   </tr>
   <tr>
     <td>HBase</td>
     <td>Content</td>
     <td>JCL</td>
   </tr>
</table>

Difference between HTML4.01, XHTML and HTML5

HTML4 XHTML HTML5
No difference No difference All layout related attributes of <td> tag are deprecated in HTML5

Attributes used with <td> tag

Attribute Description
colspan To set how many columns a cell will span.
headers Describes the header cells which are related to a particular cell.
rowspan To set how many rows a cell will span.
align Describes the alignment of elements based on nearby elements.
(HTML5 does not support this attribute with this tag).
abbr Sets the abbreviation for the content of the HTML Document
(HTML5 does not support this attribute).
axis To Categorize cells to group related columns of information.
(HTML5 does not support this attribute).
bgcolor Describes Background color of the elements.
(HTML5 does not support this attribute with this tag).
border Border of the elements is defined.
(HTML5 does not support this attribute with this tag).
char Sets the alignment of the content inside a cell to a character. The default value of char is decimal-point character.
(HTML5 does not support this attribute with this tag).
charoff Sets the character offset i.e. the number of characters the content will align from a particular specified character.
(HTML5 does not support this attribute with this tag).
height Height of the cell of the table in pixels or %.
(HTML5 does not support this attribute).
nowrap Informs the browser that it should not wrap the content of the cell.
(HTML5 does not support this attribute with this tag).
scope To relate header & data cells using any one the values out of these -
row, rowgroup, col, or colgroup.
(HTML5 does not support this attribute with this tag).
valign To align the content of the cell vertically at top, bottomp, middle, or baseline.
(HTML5 does not support this attribute).
width Width of the cell of the table in pixels or %.
(HTML5 does not support this attribute).

Global Attributes

The <td> tag supports Global attributes.

Event Attributes

The <td> tag supports Event attributes.

Supporting Browsers

supporting-browsers for tags

CSS Default value

display: table-cell;
vertical-align: inherit;

Related Tags

<table><tr><th><caption><thead><tfoot><colgroup> & <col> tags.

Tutorials for all brains!