36 of 133 menu

The th tag

The th tag defines a header cell of an HTML table.

By default, the text in the header cell is centered and bold. This behavior can be changed using the CSS properties text-align and font-weight.

Example

Let's create a table with cells th and td:

<table> <tr> <th>Name</th> <th>Surn</th> <th>Salary</th> </tr> <tr> <td>name1</td> <td>surn1</td> <td>200$</td> </tr> <tr> <td>name2</td> <td>surn2</td> <td>1000$</td> </tr> </table> table, td, th { border: 1px solid black; }

:

See also

  • tags thead, tbody and tfoot,
    which group the rows of the table
  • tag caption,
    which sets the title of the entire table
  • property vertical-align,
    which sets the vertical alignment of the text
  • attributes rowspan and colspan,
    which combine the rows and columns of a table
byenru