HTML

td Tag in HTML

Example

A simple HTML table, with two rows and four table cells:
				
					<table>
  <tr>
    <td>Cell A</td>
    <td>Cell B</td>
  </tr>
  <tr>
    <td>Cell C</td>
    <td>Cell D</td>
  </tr>
</table>
				
			

Definition and Usage

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

An HTML table has two kinds of cells:

  • Header cells – contains header information (created with the <th> element)
  • Data cells – contains data (created with the <td> element)

The text in <td> elements are regular and left-aligned by default.

The text in <th> elements are bold and centered by default. 

Attributes

AttributeValueDescription
colspannumberSpecifies the number of columns a cell should span
headersheader_idSpecifies one or more header cells a cell is related to
rowspannumberSets the number of rows a cell should span

Global Attributes

The <td> tag also supports the Global Attributes in HTML.


Event Attributes

The <td> tag also supports the Event Attributes in HTML.

Related Articles