Open In App
Related Articles

HTML th Tag

Improve Article
Save Article
Like Article

The <th> tag in HTML is used to set the header cell of a table. Two types of cells in the HTML table. 

  • Header Cell: It is used to hold the header information.
  • Standard Cell: It is used to hold the body of data.

The working of both tags (<th> and <td>) are the same, but the text properties are different. In <th> text is bold and centered, and in <td> text is regular and left align by default.


<th> Contents... </th>

Attributes: There are many attributes supported by HTML5 are listed below: 

  • abbr: This attribute is used as an abbreviated version of the text content in a header cell.
  • colspan: Number of columns a header cell should span.
  • headers: Specifies one or more header cells a cell is related to.
  • rowspan: Set the number of rows a header cell should span.
  • scope: It is used to specify the score of header content.

Attributes: There are many attributes supported by HTML4.1 but removed from HTML5 are listed below: 

  • align: Set the alignment of the text content.
  • axis: Categories header cells.
  • bgcolor: Set the background color of a header cell.
  • char: Aligns the content in a header cell to a character.
  • charoff: It is used to sets the number of characters that will be aligned from the character specified by the char attribute. The value of these attributes is in numeric form.
  • height: Set the height of a header cell.
  • valign: It is used to set the vertical alignment of text content.
  • width: It is used to set the width of a header cell



<!DOCTYPE html>
        <h2>th Tag</h2>
                    <!-- th tag starts here -->
                    <th>User Id</th>
                    <!-- th tag end here -->


Supported Browsers: 

  • Google Chrome 1 and above
  • Edge 12 and above
  • Firefox 1 and above
  • Internet Explorer
  • Safari
  • Opera

Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 01 Aug, 2022
Like Article
Save Article
Similar Reads
Complete Tutorials