ExampleA simple HTML table with three rows, two header cells and four data cells:
Month Savings January $100 February $80
Definition and Usage
<th> tag defines a header cell in an HTML table.
An HTML table has two kinds of cells:
- Header cells – contains header information (created with the
- Data cells – contains data (created with the <td> element)
The text in
<th> elements are bold and centered by default.
The text in <td> elements are regular and left-aligned by default.
|abbr||text||Specifies an abbreviated version of the content in a header cell|
|colspan||number||Specifies the number of columns a header cell should span|
|headers||header_id||Specifies one or more header cells a cell is related to|
|rowspan||number||Specifies the number of rows a header cell should span|
|Specifies whether a header cell is a header for a column, row, or group of columns or rows|
<th> tag also supports the Global Attributes in HTML.
<th> tag also supports the Event Attributes in HTML.