Easy Tutorial
❮ Att Textarea Form Ev Onmouseup ❯

HTML <td> Tag

Example

A simple HTML table with two cells:


Browser Support

All major browsers support the <td> tag.


Tag Definition and Usage

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

There are two types of cells in HTML tables:

Text in <th> elements is typically bold and centered.

Text in <td> elements is typically regular left-aligned text.


Tips and Notes

Tip: Use the colspan and rowspan attributes if you need the content to span multiple rows or columns!


Differences Between HTML 4.01 and HTML5

Some attributes that were supported in HTML 4.01 are no longer supported in HTML5.


Attributes

Attribute Value Description
abbr text Not supported in HTML5. Specifies an abbreviated version of the content in a cell.
align left <br>right <br>center <br>justify <br>char Not supported in HTML5. Specifies the horizontal alignment of content in a cell.
axis category_name Not supported in HTML5. Categorizes cells.
bgcolor rgb(x,x,x)<br>#xxxxxx<br>colorname Not supported in HTML5. Deprecated in HTML 4.01. Specifies the background color of a cell.
char character Not supported in HTML5. Specifies the character to align the content on.
charoff number Not supported in HTML5. Specifies the offset of the alignment character.
colspan number Specifies the number of columns a cell should span.
headers header_id Specifies one or more header cells a cell is related to.
height pixels<br>% Not supported in HTML5. Deprecated in HTML 4.01. Sets the height of a cell.
nowrap nowrap Not supported in HTML5. Deprecated in HTML 4.01. Specifies that the content inside a cell should not wrap.
rowspan number Sets the number of rows a cell should span.
scope col <br>colgroup <br>row <br>rowgroup Not supported in HTML5. Defines a way to associate header cells with data cells.
valign top <br>middle <br>bottom <br>baseline Not supported in HTML5. Specifies the vertical alignment of content in a cell.
width pixels<br>% Not supported in HTML5. Deprecated in HTML 4.01. Specifies the width of a cell.

Global Attributes

The <td> tag supports HTML's global attributes.


Event Attributes

The <td> tag supports HTML's event attributes.


Try It - Examples

Table Headers

Empty Cells

Table with Caption

Tags Inside a Table

Table Cells Spanning Rows or Columns


Related Articles

HTML Tutorial: HTML Tables

HTML DOM Reference Manual: Td Object

❮ Att Textarea Form Ev Onmouseup ❯