<th>
Browser |
|
---|
The TH element defines a table header cell.
<th>header cell</th>
The text within the TH element displayed in bold.
The attributes are same as the TD element.
Example
<table border="1" width="100%">
<tr>
<th>Column heading</th>
<th>Column heading</th>
<th>Column heading</th>
</tr>
<tr>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
<td>Row1 - Col3</td>
</tr>
<tr>
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
<td>Row2 - Col3</td>
</tr>
</table>
- Output
-
Column heading Column heading Column heading Row1 - Col1 Row1 - Col2 Row1 - Col3 Row2 - Col1 Row2 - Col2 Row2 - Col3
<table border="1" width="100%">
<tr>
<th>Row heading</th>
<td>Row1 - Col1</td>
<td>Row1 - Col2</td>
</tr>
<tr>
<th>Row heading</th>
<td>Row2 - Col1</td>
<td>Row2 - Col2</td>
</tr>
<tr>
<th>Row heading</th>
<td>Row3 - Col1</td>
<td>Row3 - Col2</td>
</tr>
</table>
- Output
-
Row heading Row1 - Col1 Row1 - Col2 Row heading Row2 - Col1 Row2 - Col2 Row heading Row3 - Col1 Row3 - Col2