Vertical Table Headers | Tables
To use the first column as table headers, define the first cell in each row as a <th>
element:
<!DOCTYPE html>
<html>
<head>
<title>Vertical Table Headers</title>
</head>
<body>
<h2>Vertical Table Headers</h2>
<p>The first column becomes table headers if you set the first table cell in each table row to a TH element:</p>
<table style="width:100%">
<tr>
<th>Firstname</th>
<td>Taranpreet</td>
<td>Mehakpreet</td>
</tr>
<tr>
<th>Lastname</th>
<td>Singh</td>
<td>Kaur</td>
</tr>
<tr>
<th>Class</th>
<td>6th</td>
<td>7th</td>
</tr>
</table>
</body>
</html>