Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

HTML5 <td> tag


May 03, 2021 HTML5


Table of contents


HTML5 is used to represent cells in a table. Please refer to the following example:

A simple HTML table with two cells:

<table border="1">
<tr>
<td>Cell A</td>
<td>Cell B</td>
</tr>
</table>
Try it out . . .
(See bottom of page for more examples)

Browser support

HTML5 <td> tag HTML5 <td> tag HTML5 <td> tag HTML5 <td> tag HTML5 <td> tag

All major browsers support the hashtag.


Label definition and instructions for use

The label defines the standard cells in the HTML table.

HTML tables have two cell types:

  • Header Cell - Contains header information (created by the element of the .lt;th-gt; element)
  • Standard Cells - Contains data (created by the element of slt;td?gt;

The text in the element is usually bold and centered.

The text in the element is usually normal left-aligned text.


Tips and comments

Tip: If you need to span content across multiple rows or columns, use the colspan and rowspan properties!


The difference between HTML 4.01 and HTML5

Some properties in HTML 4.01 are no longer supported in HTML 5.


Property

Property Value Describe
abbr text HTML5 is not supported. Specifies an abbreviated version of the content in the cell.
align left
right
center
justify
char
HTML5 is not supported. Specifies the horizontal alignment of cell contents.
axis category_name HTML5 is not supported. Classify cells.
bgcolor rgb(x,x,x)
#xxxxxx
colorname
HTML5 is not supported. H TML 4.01 is obsolete. Specifies the background color of the cell.
char character HTML5 is not supported. Specify which character to align the content against.
charoff number HTML5 is not supported. Specifies the offset of aligned characters.
colspan number Specifies the number of columns a cell can span.
headers header_id Specifies one or more header cells associated with a cell.
height pixels
%
HTML5 is not supported. HTML 4.01 is obsolete.
Set the height of the cell.
nowrap nowrap HTML5 is not supported. HTML 4.01 is obsolete.
Specify whether the contents of the cell are folded.
rowspan number Sets the number of rows a cell can span.
scope col
colgroup
row
rowgroup
HTML5 is not supported. Defines the method that associates the header cell with the data cell.
valign top
middle
bottom
baseline
HTML5 is not supported. Specifies how the contents of the cells are arranged vertically.
width pixels
%
HTML5 is not supported. H TML 4.01 is obsolete. Specifies the width of the cell.


Global properties

Labels support the global properties of HTML.


The event property

The tag supports the event properties of HTML.


HTML5 <td> tag

Try it - instance

The title in the table
This example shows how to display the table title.

Empty cell
This example shows how to use to work with cells without content.

Table with title
This example shows a table with a title.

The label in the table
This example shows how to display elements within other elements.

Table cells that span rows or columns
This example shows how to define table cells that span rows or columns.


Related articles

HTML tutorial: HTML tables

HTML DOM Reference Manual: Td Objects