HTML Tutorial

HTML Tag: <tbody>

Usage of <tbody>

The <tbody> tag groups table data in rows. It improves table accessibility by defining the start and end of the table body, excluding the header and footer.

Attributes of <tbody>

  • None

Examples with <tbody>

<table>
  <thead>
    <tr>
      <th>Name</th>
      <th>Age</th>
      <th>City</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>John</td>
      <td>30</td>
      <td>New York</td>
    </tr>
    <tr>
      <td>Jane</td>
      <td>25</td>
      <td>London</td>
    </tr>
  </tbody>
</table>

Exploring the <tbody> tag

This example demonstrates the <tbody> tag:

<!DOCTYPE html>
<html>
<head>
  <title>Table with <tbody></title>
</head>
<body>
  <h1>Employee Information</h1>
  <table>
    <thead>
      <tr>
        <th>Name</th>
        <th>Age</th>
        <th>City</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>John</td>
        <td>30</td>
        <td>New York</td>
      </tr>
      <tr>
        <td>Jane</td>
        <td>25</td>
        <td>London</td>
      </tr>
      <tr>
        <td>Peter</td>
        <td>28</td>
        <td>Paris</td>
      </tr>
    </tbody>
    <tfoot>
      <tr>
        <th colspan="3">Total</th>
        <th>3</th>
      </tr>
    </tfoot>
  </table>
</body>
</html>