HTML Tags

HTML <th> Tag

The <th> tag in HTML defines a header cell in a table.
Header cells are typically displayed in bold text and centered by default. They help describe the content of each column or row, making data tables easier to understand and accessible.

Syntax

html

<th scope="col|row">Header Content</th>

Attributes

AttributeDescription
abbrProvides an abbreviated version of the header cell content for screen readers.
colspanSpecifies the number of columns a header cell should span.
rowspanSpecifies the number of rows a header cell should span.
headersAssociates the header cell with one or more data cells (id values of <td> elements).
scopeDefines whether the header applies to a row, column, row group, or column group (row, col, rowgroup, colgroup).

💡 Tip: Use the scope attribute to improve accessibility, especially for assistive technologies.

Example

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>HTML th Tag Example</title>
</head>
<body>
  <h2>Example of the <th> Tag</h2>
  <table border="1">
    <tr>
      <th scope="col">Month</th>
      <th scope="col">Savings</th>
    </tr>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$150</td>
    </tr>
  </table>
</body>
</html>

Output

Browser Output

html

There is visible output for this tag — it displays the table header cells in bold and center-aligned text by default.
Use our TryIt Editor to test and modify the example live.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesYes

Notes

  • <th> is always contained inside <tr>.
  • Can be used with <thead>, <tbody>, or <tfoot> to structure table headers.
  • scope, colspan, and rowspan attributes improve accessibility and semantic clarity.
  • Browser styling: Bold and center-aligned by default, but fully customizable via CSS.

Conclusion

  • The <th> tag defines header cells in a table, giving structure to columns or rows.
  • It enhances readability and accessibility, especially for screen readers.
  • Using <th> properly ensures your tables are semantic, clear, and easy to interpret.