HTML | tbody Tag

The <tbody> tag in HTML is used to make a group of same type of content of body element. This tag is use in HTML table with header and footer which is known as “thead” and “tfoot”. <tbody> tag is child tag of table tag and parent tag of <tr> and <td> tags.

Syntax:

<tbody> // Table contents   </tbody>

Attributes: Some attributes are supported by <tbody> tag in HTML4.1 but not supported in HTML5. The list of attributes are given below:



  • align: Set the alignment of the content.
  • valign: Set the vertically alignment of the content.
  • char: Set the alignment of content inside <thead> tag to a character.
  • charoff: It is used to set the characters the content inside the <thead> tag aligned from the character specified by the char attribute.

Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>tbody tag</title>
        <style>
            body {
                text-align:center;
            }
            h1 {
                color:green;
            }
            th {
                color:blue;
            }
            table, tbody, td {
                border: 1px solid black;
                border-collapse: collapse;
            }
        </style>
    </head>
    <body>
        <center>
        <h1>GeeksforGeeks</h1>
        <h2>tbody Tag</h2>
        <table>
            <thead>
                <tr>
                    <th>Name</th>
                    <th>User Id</th>
                </tr>
            </thead>
              
            <!-- tbody tag starts from here -->
            <tbody>
                <tr>
                    <td>Shashank</td>
                    <td>@shashankla</td>
                </tr>
                    <tr>
                    <td>GeeksforGeeks</td>
                    <td>@geeks</td>
                </tr>
            </tbody>
            <!-- tbody tag ends here -->
              
        </table>
        </center>
    </body>
</html>                    

chevron_right


Output:

Supported Browsers: The browser supported by <tbody> tag are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari


My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.