HTML <th> Tag

HTML <th> Tag

In this tutorial, we will learn about th tag in HTML with the help of examples.

<th> Tag

Th tag <th> is used to add footer to the HTML table.

Note : The text in <th> tag are bold and centered by default.




<!DOCTYPE html>
    <title>th tag</title>
        <th>First Name</th>
        <th>Last Name</th>

Output :

Image Not Loaded

Specific Attribute

Attribute Value Description
abbr abbreviated_text It specifies an abbreviated version of the content in a cell
align right
It is used for visual alignment
axis name It is used to specify a category for this th
bgcolor rgb(x,x,x)
It specifies the background color of the table
char character It specifies which character to align text on align = char
charoff pixels
It specifies an alignment offset(either in pixels or percentage value) against the first character as specified with the char attribute. It is used when align = char
colspan number It specifies the number of columns the current cell spans accross
header height It specifies a space-seperated list of header cells that contain information about this cell. The value needs to correspond with the id of the header cell(which is set using the id attribute). This attribute is useful for non-visual browsers
height pixels It specify the height of the header cell
nowrap nowrap It is used to prevents text from automatically wrapping
rowspan numbers It is used to specify the number of rows the current cell spans across
scope col
It is used to specify whether a header cell is a header for a column, row, or group of columns or rows
valign top
It is used for vertical alignment
width pixels
It is used to specify the width of the table

Global Attribute

Th Tag support all the global attributes of HTML.

Event Attribute

Th Tag support all the event attributes of HTML.

Next Tutorial

We hope that this tutorial helped you develop better understanding of the concept of <th> tag in HTML.

Keep Learning : )

In the next tutorial, you'll learn about HTML <thead> Tag.

- Related Topics