HTML5 <td> Tag

The HTML <td> element is used to define a cell of a table that contains data. It participates in the table model.

The only content permitted inside this element is flow content. The start tag is mandatory for this element. The end tag may be omitted, if it is immediately followed by a <th> or <td> element or if there are no more data in its parent element. The parent of the <td> tag can only be a <tr> element.

The following style is applied to this element by default:

td {
  display: table-cell;
  vertical-align: inherit;
}

Attributes

colspan

This attribute is used to specify the number of columns to which this cell extends. It should be a non-negative integer. Its default value is 1. Values higher than 1000 will be considered as incorrect and will be set to the default value of 1.

headers

This attribute contains a list of space-separated strings, each corresponding to the id attribute of the <th> elements that apply to this element.

rowspan

This attribute is used to specify the number of rows to which this cell extends. It should be a non-negative integer. Its default value is 1. When its value is set to 0, it extends until the end of the table section (<thead>, <tbody>, <tfoot> that the cell belongs to. Values higher than 65534 are clipped down to 65534.

Reader Comments

1. You can register or login to post a comment. Asking readers to register improves the quality of discussion.

2. As a registered user, you will also get to access features like choosing between a light and dark theme or anything else that we might implement in future.

Follow Us For Updates

FacebookTwitterGoogle+
Go To Top