HTML | thead Tag

The <thead> tag in HTML is used to give header to group of content of body. This tag is used in HTML table as head and body which is known as thead and tbody.

Syntax:

<thead>
// Table head Contents...
</thead>

Attributes:



  • align: Set the alignment of the text content.
  • valign: Set the vertically alignment of the text content.
  • char: Set the align of content inside the <thead> element to a character.
  • charoff: It is used to sets the number of characters that will be aligned from the character specified by the char attribute. The value of this attributes are in numeric form.
  • Example:

    filter_none

    edit
    close

    play_arrow

    link
    brightness_4
    code

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

    chevron_right

    
    

    Output:

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

    • Google Chrome
    • Edge
    • Firefox
    • Safari
    • Opera


    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.