HTML <td> Tag
Description:
The HTML <td> tag is used for specifying a cell (or table data) within a table.
Specific Attributes:
| Attribute | Definition |
| headers | Specifies the table headers related to a cell |
| scope | Defines a way to associate header cells and data cells in a table |
| abbr | Specifies an abbreviated version of the content in a cell |
| axis | Categorizes cells |
| rowspan | Sets the number of rows a cell should span |
| colspan | Specifies the number of columns a cell should span |
| nowrap | Specifies that the content inside a cell should not wrap |
| width | Specifies the width of a cell |
| height | Sets the height of a cell |
Other Attributes:
| Attribute | Definition |
| dir |
Specifies the text direction for the content in
an element.
|
| class | Specifies a classname for an element. |
| id | Specifies a unique id for an element. |
| lang | Specifies a language code for the content in an element. |
| title | Specifies a title to associate with the element. Many browsers will display this when the cursor hovers over the element (similar to a "tool tip"). |
| style | Specifies an inline style for an element. |
| bgcolor | Background color of the td. |
| align | Visual alignment. Possible values:
|
| valign | Vertical alignment. Possible values:
|
| char | Specifies a character to use for aligning text to. Used when align=char. |
| charoff | Specifies an alignment offset (either in pixels or percentage value) against the first character as specified with the char attribute. Used when align=char |
Example Code:
<table border="1">
<tr>
<th>Animal</th>
<th>Color</th>
</tr>
<tr>
<td>Mouse</td>
<td>White</td>
</tr>
</table>
Result
| Animal | Color |
|---|---|
| Mouse | White |