HTML <th> tag
HTML <th> tag
The <th>
tag specifies a header cell in an HTML table.
There are two kinds of cells available for an HTML table.
<th>
(header cell) - contains column heading.- <td> (data cell) - contains table data.
Note: By default, the text inside the <th>
element are bold and centered.
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<table>
<tr>
<th>S.No</th>
<th>Name</th>
</tr>
<tr>
<td>1</td>
<td>Brendan</td>
</tr>
<tr>
<td>2</td>
<td>Eich</td>
</tr>
</table>
</body>
</html>
Attributes
The following are the attributes of <th> tag. Also try Global attributes.
Attribute | Value | Explanation |
---|---|---|
abbr | text | Specifies an abbreviated description of the content in a <th> element. |
colspan | number | Specifies how many columns the <th> element should extend. |
headers | ID | Contains a list of space-separated strings, each corresponding to the id attribute of the <th> elements that apply to this element. |
rowspan | number | Specifies how many rows the <th> element should extend. |
scope |
| Specifies whether a header cell is a header for a row, column, rowgroup, or colgroup. |
Deprecated Attributes
The following attributes should not be used in any case.
Attribute | Value | Explanation |
---|---|---|
align |
| Specifies the horizontal alignment of the content in a <th> element. |
axis | ID | Specifies a grouping of cell. |
bgcolor |
| Specifies the background color of a <th> element. |
char | text | Specifies a character to align the content inside <th> element. |
charoff | number | Specifies the number of characters to offset the <th> data from the alignment characters specified by the char attribute. |
height | px / % | Specifies the height of the <th> element. |
valign |
| Specifies the vertical alignment of the content in the <th> element. |
width | px / % | Specifies the width of the <th> element. |
Reminder
Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in HTML.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.