HTML tbody Tag

HTML <tbody> tag is used to group the table rows (<tr>) together, which indicates that this is body part of a table (<table>).

The <tbody> tag should always be nested within the parent <table> element.

The <tbody> is used along with <thead> and <tfoot> which shows the different part of the table that are table head, table body, and table footer, however, it does not affect the layout of the table.

These components are utilized to offer semantic details that can enhance accessibility, or to display the header on the top and the footer at the bottom when printing a sizable table.

Tips: The <tbody> tag must contain one or more <tr> elements.

Syntax

Example

<tbody>............</tbody>

Following are some details regarding the HTML <tbody> element:

Display Inline
Start tag/End tag Both Start and End tag
Usage Table body

Example

Example

<!DOCTYPE html>

<html>

<head>

	<title>HTML tbody tag</title>

	<style>

		body{

		margin-left: 195px;"

		}

	</style>

</head>

<body>

 <h2>Example of the tbody tag</h2>

 <table border="1" bgcolor="#98f5ff">

   <thead>

   	   <tr>

   	   	<th>EmpId</th>

   	   	<th>Name</th>

   	   	<th>Email-Id</th> 	

   	   </tr>

   </thead>

 <tbody>

      <tr>

      	<td>121</td>

      	<td>John</td>

      	<td>john123@gmail.com</td>

      </tr>



      <tr>

      	<td>122</td>

      	<td>William </td>

      	<td>william56@gmail.com</td>

      </tr>



      <tr>

      	<td>123</td>

      	<td>Amit</td>

      	<td>amitk98@gmail.com</td>

      </tr>	

   </tbody>

</table>

</body>

</html>

Output:

Attribute:

Tag-specific attributes:

Attribute Value Description
align rightleftcenterjustifychar It determines the alignment of the content inside the <tbody> element.(Not Supported in HTML5)
char character It specifies the alignment of the <tbody> content to the character.(Not Supported in HTML5)
charoff Number It specifies the number of characters the content will be aligned from the character specified by the char attribute.(Not Supported in HTML5)
valign topmiddlebottombaseline It determines the vertical alignment of the content inside the <tbody> element.(Not Supported in HTML5)

Global attribute:

The <tbody> tag facilitates the utilization of Global attributes within HTML.

Event attribute:

The <tbody> tag enables the utilization of Event attributes within HTML.

Supporting Browsers

Element Chrome IE Firefox Opera Safari
<tbody> Yes Yes Yes Yes Yes

Input Required

This code uses input(). Please provide values below: