English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

Complete List of HTML Tags

HTML: <td> tag

HTML <td> tag defines a standard cell in an HTML table. The <td> element defines a table cell containing data. This tag is also commonly referred to as the <td> element.

Online Example

 HTML tables with multiple cells:

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>HTML td tag usage (Basic Tutorial Website oldtoolbag.com)</title>
</head>
<body>
<table border="1">
  <tr>
    <th>Column 1 Heading</th>
    <th>Column 2 Heading</th>
  </tr>
  <tr>
    <td>Data in Column 1, Row 2</td>
    <td>Data in Column 2, Row 2</td>
  </tr>
  <tr>
    <td>Data in Column 1, Row 3</td>
    <td>Data in Column 2, Row 3</td>
  </tr>
  <tr>
    <td>Data in Column 1, Row 4</td>
    <td>Data in Column 2, Row 4</td>
  </tr>
</table>
</body>
</html>
Test see ‹/›

In this HTML5in the document example, we used the <table> tag to create a table that has2columns and4rows.1row is defined by the first2cells are defined by the <th> tag. The2to4Rows are defined by the <td> tag to define standard table cells.

Browser Compatibility

IEFirefoxOperaChromeSafari

All major browsers support the <td> tag.

Definition and Usage

The <td> tag defines the standard cell in an HTML table.

HTML tables have two types of cells:

  • header cell - Contains header information (created by <th> element created)

  • standard cell - Contains data (created by

The text in the <th> element is usually bold and centered.

The text in the <td> element is usually left-aligned plain text.

Hints and Notes

Hint:If you need to span content across multiple rows or columns, use the colspan and rowspan attributes!

HTML 4.01 and HTML5differences between

HTML 5 No longer supports HTML 4.01 Some attributes in

Attribute

AttributeValueDescription
abbrtextHTML5 Not supported. Specify the abbreviated version of the content in the cell.
alignleft
 right
 center
 justify
 char
HTML5 Not supported. Specify the horizontal alignment of the cell content.
axiscategory_nameHTML5 Not supported. Classify the cell.
bgcolorrgb(x,x,x)
#xxxxxx
colorname
HTML5 Not supported. HTML 4.01 Deprecated. Specify the background color of the cell.
charcharacterHTML5 Not supported. Specify the character to align the content based on.
charoffnumberHTML5 Not supported. Specify the offset of the alignment character.
colspannumberSpecify the number of columns that a cell can span horizontally.
headersheader_idSpecify one or more header cells associated with the cell.
heightpixels
%
HTML5 Not supported. HTML 4.01 Deprecated.
Set the height of the cell.
nowrapnowrapHTML5 Not supported. HTML 4.01 Deprecated.
Specify whether the content in a cell wraps.
rowspannumberSet the number of rows that a cell can span horizontally.
scopecol
 colgroup
 row
 rowgroup
HTML5 Not supported. Defines the method to associate header cells with data cells.
valigntop
 middle
 bottom
 baseline
HTML5 Not supported. Specifies the vertical alignment of the cell content.
widthpixels
%
HTML5 Not supported. HTML 4.01 Deprecated. Specifies the width of the cell.

Global Attributes

Support for <td> tag Global Attributes of HTML.

Event Attributes

Support for <td> tag HTML Event Attributes.

Try it yourself - Example

Table cells that span rows or columns
This example demonstrates how to define table cells that span rows or columns.

Tags within Tables
This example demonstrates how to display elements within different elements.

Cell padding
This example demonstrates how to use Cell padding to create space between the cell content and its border.

Cell spacing
This example demonstrates how to use Cell spacing to increase the distance between cells.

Related Articles

HTML Tutorial:HTML Tables

HTML DOM Reference Manual: Td Object