HTML TBODY Tag || Tbody Tag in HTML
×

HTML TBODY <tbody> Tag

0 429

The HTML TBODY <tbody> tag is used for grouping of table rows in an HTML table. It defines a block of rows that consist of a body of data for the parent <table> element. The <tbody> tag can be used with the <thead> tag and the <tfoot> tag in determining each part of the table (header, footer, body).

The <tbody> element should always come after a <thead> element and may come before or after a <tfoot> element. Browsers can use these elements to enable scrolling of the table body independently of the header and footer.

Also, when printing a large table that spans multiple pages, these elements can enable the table header and footer to be printed at the top and bottom of each page.

The <tbody> tag must be used in the follwing context: As a child of a <table> element, after any <caption>, <colgroup>, and <thead> elements.

Syntax:

The <tbody> tag is written as <tbody></tbody> with the body of data inserted between the start and end tags.

Program:

<!DOCTYPE html>
<html>
<head>
<title>HTML TBODY Tag</title>
</head>
<body>
 <h2>Example of TBODY Tag</h2>
<table border="1">
 <thead>
 <tr>
<th>Emp ID</th>
<th>Name</th>
<th>Email ID</th>
 </tr>
 </thead>
 <tbody>
<tr>
<td>101</td>
<td>Ram</td>
<td>dummy123@icon.com</td>
</tr>

<tr>
<td>102</td>
<td>Dummy</td>
<td>dummy1234@icon.com</td>
</tr>
<tr>
<td>103</td>
<td>Jai</td>
<td>hello@gmail.com</td>
</tr>
 </tbody>
</table>
</html>

Output:




Share:


Leave a Reply


Comments
    Waiting for your comments