HTML <tbody> tag is used to group the body content of a table separating it from the header <thead> and footer <tfoot> sections. It's particularly helpful for organizing larger tables or when applying specific styles or scripts to different parts of the table.
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML Table with tbody</title>
<style>
table, th, td {
border: 1px solid black;
border-collapse: collapse;
padding: 8px;
}
thead {
background-color: #f2f2f2;
}
</style>
</head>
<body>
<h2>COVID-19 Cases in Indian Cities</h2>
<table>
<thead>
<tr>
<th>City</th>
<th>Active Cases</th>
<th>Recovered</th>
<th>Deaths</th>
</tr>
</thead>
<tbody>
<tr>
<td>Delhi</td>
<td>1,200</td>
<td>50,000</td>
<td>900</td>
</tr>
<tr>
<td>Mumbai</td>
<td>2,500</td>
<td>60,000</td>
<td>1,100</td>
</tr>
<tr>
<td>Bengaluru</td>
<td>800</td>
<td>30,000</td>
<td>500</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">Data from Local Health Departments</td>
</tr>
</tfoot>
</table>
</body>
</html>