<th> : Table Header element

Introduction

The <th> element in HTML stands for “Table Header.” It’s used to define a header cell within a table. Header cells typically contain labels or titles for the columns or rows of the table.

Here’s an example of how you might use the <th> element to create a table header:

Output :

In this example:

  • Each <th> element represents a header cell in the table.
  • Header cells are typically contained within the first row (<tr>) of the table.
  • Header cells are commonly used to label the columns or rows of the table.
  • CSS is used to style the table, including setting border styles, cell padding, and alignment.

This results in a simple table with three columns: Name, Age, and Country, where each column is labeled with a header cell (<th>).

Leave a Comment