HTML tag
Example
A simple HTML table with two header cells and two data cells:
<
table
border
=
"
1
"
<
tr
<
th
Month
th
<
th
Savings
th
tr
<
tr
<
td
January
td
<
td
$100
td
tr
tableTry it »
(More examples are at the bottom of the page)
Browser support





All major browsers support the tag.
Tag Definition and Usage Notes
The tag defines a header cell in an HTML table.HTML tables have two types of cells:
- Header cell - contains header information (created by the element)
- Standard cell - contains data (created by the element)
Tips and Notes
**Tip:** If you need to span content across multiple rows or columns, use the colspan and rowspan attributes!
Differences between HTML 4.01 and HTML5
Some attributes from HTML 4.01 are no longer supported in HTML 5.
property
| property | Value | Description |
|---|---|---|
| abbr | text | Not supported in HTML5. Specifies an abbreviated version of the content in a header cell. |
| align | left |
right
center
justify
char | HTML5 does not support。 Specifies表头单元格内容的水平对齐方式。 |
| axis | category_name | Not supported in HTML5. Categorizes a header cell. | | bgcolor | rgb(x,x,x)
#xxxxxx
colorname | Not supported in HTML5. Deprecated in HTML 4.01. Specifies the background color of a header cell. | | char | character | Not supported in HTML5. Specifies which character to align content on. | | charoff | number | Not supported in HTML5. Specifies the offset of the alignment character. | | colspan | number | Specifies the number of columns a header cell should span. | | headers | header_id | Specifies one or more header cells a header cell is related to. | | height | pixels
% | Not supported in HTML5. Deprecated in HTML 4.01. Specifies the height of a header cell. | | nowrap | nowrap | Not supported in HTML5. Deprecated in HTML 4.01. Specifies whether the content in a header cell should be wrapped. | | rowspan | number | Specifies the number of rows a header cell should span. | | scope | col
colgroup
row
rowgroup | Specifies whether a header cell is a header for a column, row, or group of columns or rows. | | valign | top
middle
bottom
baseline | Not supported in HTML5. Specifies the vertical alignment of the content in a header cell. | | width | pixels
% | Not supported in HTML5. Deprecated in HTML 4.01. Specifies the width of a header cell. |
Global Attributes
The tag supports [HTML Global Attributes](/tags/ref-standardattributes.html).Event attribute
The tag supports all [HTML event attributes](/tags/ref-eventattributes.html).Try it - Example
Caption in a table
This example demonstrates how to display a table caption.
Empty cells
This example demonstrates how to use " " to handle cells with no content.
A table with a caption
This example demonstrates a table with a caption.
Tags inside a table
This example demonstrates how to display elements inside other elements.
Table cells spanning rows or columns
This example demonstrates how to define table cells that span rows or columns.
Related Articles
HTML Tutorial:HTML Tables
HTML DOM Reference Manual: Th Object