HTML td tag
HTML Tag Reference
Example
CompletedA simple HTML table, with two table cells:
<table>
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
</table>
Try it Yourself
More "Try it Yourself" examples below.
Definition and Usage
CompletedThe <td> tag defines a standard cell in an HTML table.
An HTML table has two kinds of cells:
- Header cells - contains header information (created with the element)
- Standard cells - contains data (created with the element)
The text in <th> elements are bold and centered by default.
The text in <td> elements are regular and left-aligned by default.
Browser Support
Completed| Element | |||||
|---|---|---|---|---|---|
| <table> | Yes | Yes | Yes | Yes | Yes |
Tips and Notes
CompletedTip: Use the colspan and rowspan attribute to let the content span over multiple columns or rows!
Differences Between HTML 4.01 and HTML5
CompletedAll layout attributes are removed in HTML5.
Attributes
Completed| Attribute | Value | Description |
|---|---|---|
| abbr | text | Not supported in HTML5. Specifies an abbreviated version of the content in a cell |
| align | left right center justify char |
Not supported in HTML5. Aligns the content in a cell |
| axis | category_name | Not supported in HTML5. Categorizes cells |
| bgcolor | rgb(x,x,x) #xxxxxx colorname |
Not supported in HTML5. Specifies the background color of a cell |
| char | character | Not supported in HTML5. Aligns the content in a cell to a character |
| charoff | number | Not supported in HTML5. Sets the number of characters the content will be aligned from the character specified by the char attribute |
| 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 % |
Not supported in HTML5. Sets the height of a cell |
| nowrap | nowrap | Not supported in HTML5. Specifies that the content inside a cell should not wrap |
| rowspan | number | Sets the number of rows a cell should span |
| scope | col colgroup row rowgroup |
Not supported in HTML5. Defines a way to associate header cells and data cells in a table |
| valign | top middle bottom baseline |
Not supported in HTML5. Vertical aligns the content in a cell |
| width | pixels % |
Not supported in HTML5. Specifies the width of a cell |
Global Attributes
CompletedThe <td> tag also supports the Global Attributes in HTML.
Event Attributes
CompletedThe <td> tag also supports the Event Attributes in HTML.
Default CSS Settings
CompletedMost browsers will display the element with the following default values:
Example
td {
display: table-cell;
vertical-align: inherit;
} 