Header cells in a table in HTML
In addition to the td tags, there are also th tags, which also create cells. But these will not be ordinary cells, but header cells, which indicate what is in a given column (or row) of the table. By default, the text in such th cells will be bold and centered.
Let's look at an example. Let's say we have a table with employees like this:
<table border="1" width="300">
<tr>
<td>John</td>
<td>Smith</td>
<td>200$</td>
</tr>
<tr>
<td>Nick</td>
<td>Mayers</td>
<td>300$</td>
</tr>
<tr>
<td>Alex</td>
<td>Jonson</td>
<td>400$</td>
</tr>
</table>
:
As you can see, the first column stores the employee's name, the second column stores the last name, and the third column stores the salary. Let's make another row at the beginning of the table, in which we'll place the column headers in the th tags:
<table border="1" width="300">
<tr>
<th>Name</th>
<th>Surname</th>
<th>Salary</th>
</tr>
<tr>
<td>John</td>
<td>Smith</td>
<td>200$</td>
</tr>
<tr>
<td>Nick</td>
<td>Mayers</td>
<td>300$</td>
</tr>
<tr>
<td>Alex</td>
<td>Jonson</td>
<td>400$</td>
</tr>
</table>
:
Repeat the example below: