Kumail.pk is a Free Platform of

Table Heading

Table Heading: HTML table allows dening a header for the columns of our table. A header cell is dened by tag and is placed inside a row tag. It is used to differentiate from the content placed inside normal data cells. To make the entire header row stand out from rest of the table contents, dened tags for all columns of the rst row tag of any tag.

Table Heading

Table Heading

HTML table allows dening a header for the columns of our table. A header cell is dened by tag and is placed inside a row tag. It is used to differentiate from the content placed inside normal data cells. To make the entire header row stand out from rest of the table contents, dened tags for all columns of the rst row tag of any tag.
 
To create table header in HTML, use the <th>… </th> tag. A table header tag is surrounded by the table row <tr>… </tr>.

Example

An HTML table with a <thead>, <tbody>, and a <tfoot> element:

<table>
  <thead>
    <tr>
      <th>Month</th>
      <th>Savings</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>January</td>
      <td>$100</td>
    </tr>
    <tr>
      <td>February</td>
      <td>$80</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td>Sum</td>
      <td>$180</td>
    </tr>
  </tfoot>
</table>

Definition and Usage

The <thead> tag is used to group header content in an HTML table.

The <thead> element is used in conjunction with the <tbody> and <tfoot> elements to specify each part of a table (header, body, footer).

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.

Note: The <thead> element must have one or more <tr> tags inside.

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

Tip: The <thead>, <tbody>, and <tfoot> elements will not affect the layout of the table by default. However, you can use CSS to style these elements (see example below)!

o create table header in HTML, use the <th>…</th> tag. A table header tag is surrounded by the table row <tr>…</tr>. The <tr> tag is surrounded by the <table> tag. A table consist of a rows and columns, which can be set using one or more <tr>, <th>, and <td> elements. Use the style attribute to add CSS properties for adding a border to the table.

A table row is defined by the <tr> tag. To create table header, use the <th> tag. Just keep in mind that you can only have a single heading in a table.

Example

You can try the following code to create table header in HTML. We’re also using the <style> tag to style the table borders

<!DOCTYPE html>
<html>
   <head>
      <style>
         table, th, td {
            border: 1px solid black;
         }
      </style>
   </head>

   <body>
      <h1>Database</h1>
      <table>
         <tr>
            <th>Database</th>
            <th>Release Year</th>
         </tr>
         <tr>
            <td>MySQL</td>
            <td>1995</td>
         </tr>
      </table>
   </body>
</html>
Table Heading

 

Apply for Free E-Certification

E-Certification