HTML THEAD Tag || THEAD Tag in HTML
×

HTML THEAD <thead> Tag

0 412

HTML THEAD <thead> tag represents the headers (group header content) of an HTML table. This is the block of rows that consist of the column labels for the parent <table> element.

The <thead> tag is used  with <tbody> and <tfoot> tags which defines table header, table body, and table footer in an HTML table.

The <thead> tag must be child of <table> tag, and it must be used before any <tbody>, <tr>, or <tfoot> Tag. The <thead> tag should contain at least one row <tr> tag inside it. The <thead> tag must be used in the following context like <caption>, and <colgroup> tag, and  before any <tbody>, <tfoot>, and <tr> tag.

Syntax:

The <thead> tag is written as <thead></thead> with the table header inserted between the start and end tags.

Program:

<!DOCTYPE html>
<html>
<head>
    <title>HTML Thead  Tag</title>
</head>
<body>
 <h2>Example of Thead 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