May 03, 2021 HTML5
HTML5 is used to represent the header of a table. Please refer to the following 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>
</table>
All major browsers support the hashtag.
Labels define header cells in HTML tables.
HTML tables have two cell types:
The text in the element is usually bold and centered.
The text in the element is usually normal left-aligned text.
Tip: If you need to span content across multiple rows or columns, use the colspan and rowspan properties!
Some properties in HTML 4.01 are no longer supported in HTML 5.
Property | Value | Describe |
---|---|---|
abbr | text | HTML5 is not supported. Specifies an abbreviated version of the content in the header cell. |
align |
left
right center justify char |
HTML5 is not supported. Specifies the horizontal alignment of the contents of the header cell. |
axis | category_name | HTML5 is not supported. Classify header cells. |
bgcolor |
rgb(x,x,x)
#xxxxxx colorname |
HTML5 is not supported. H TML 4.01 is obsolete. Specifies the background color of the header 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 that header cells can span. |
headers | header_id | Specifies one or more header cells associated with a header cell. |
height |
pixels
% |
HTML5 is not supported. H TML 4.01 is obsolete. Specifies the height of the header cell. |
nowrap | nowrap | HTML5 is not supported. H TML 4.01 is obsolete. Specifies whether the contents of the header cell are folded. |
rowspan | number | Specifies the number of rows that a header cell can span. |
scope |
col
colgroup row rowgroup |
Specifies whether the header cell is the header of a row, column, row group, or column group. |
valign |
top
middle bottom baseline |
HTML5 is not supported. Specifies how the contents of the header cells are arranged vertically. |
width |
pixels
% |
HTML5 is not supported. H TML 4.01 is obsolete. Specifies the width of the header cell. |
Labels support the global properties of HTML.
The label supports all HTML event properties.
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.
HTML tutorial: HTML tables
HTML DOM Reference Manual: Th Object