Home Tutorial Html Html5 HTML 5 th Tag, Definition of <th> tag in html5

 
 

HTML 5 th Tag, Definition of <th> tag in html5
Posted on: September 15, 2010 at 12:00 AM
In this discussion, We will introduce about the use of <th> tag in html5.

HTML 5 th Tag, Definition of <th> tag in html5

In this discussion, We will introduce about the use of <th> tag in html5. This <th> tag is used for defining the table headers of cells or columns in a table. The<th> tag is used within the <tr> tag and <tr> is nested in <table> tag. This tag must have opening and closing tags. The header will shown in bold font style in the html table.

Declaration Syntax:

The declaration of this tag is as:

<th> Column Header </th>

This tag have four specific attributes are as following:

colspan="value"  The value of this attribute specify the no of columns to be spanned and must be a non negative integer.

rowspan="value"  The value of this attribute specify the no of rows to be spanned and must be a non negative integer.

headers="value"   The value of this attribute specify space saprated list of header for <th> element .

scope="value"     The value of this attribute specify that the which cells use <th> header information. The values are as:

                                row, col, rowgroup, colgroup etc.

 

Example: th_tag.html

<!DOCTYPE html>
<html>
<head>
<title>Example of th tag</title>
</head>
  <body>Example of th tag.<p>
    <table border="1">
                  <tr>
                        <th>NAME</th>
                        <th>Sr. name</th>
                 </tr>
                <tr>
                       <td> Gyan</td>
                       <td>  Singh</td>
                </tr>
               <tr>
                      <td> Ankit</td>
                      <td> Kumar</td>
               </tr>
     </table>
  </body> 
</html>

Output:

Download This Example

Difference between html4.01 and html5.

Most of the html4.01 attributes are not supported by html5.

Related Tags for HTML 5 th Tag, Definition of <th> tag in html5:


Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.