What is TH Tag in HTML? Definition, Syntax & Example

what is TH tag  in HTML

html th tag

This Blog You Will Learn 

ஃ what is <th> tag  in HTML

ஃ Why Use <th> ?

 Syntax of HTML <th> tag

 ஃ Explain Program

 ஃ Output

what is <th> tag  in HTML

<th> tag stands table header

defines a header cell in HTML table.

<td> ,<th> cells bold and centered by default.
<th> tag is use to define a header cell in HTML  table.
<table>  -  creates the table. defines an HTML table
<tr>       - Creates rows .Defines a row in a table
<th>      - Creates header cells  ina table 
<td>      - creates data cells

Visual Structure 

html th tag






Why Use <th> ?

✔   Improves table accessibility.
✔  help- screen readers announce table structure.
✔  Distinguishes  headers visually  (bold/centered)
✔  SEO Improves page structure
✔  table data.

 Syntax of HTML <th> tag

<th>
.
.
</th>

what is th tag  in HTML

Example 

<!DOCTYPE html>
<html>
    <head>
        <title> html th tag </title>
            </head>
            <body>
                <h2>HTML th Tag </h2>
                <table>
                      <tr>
                        <th>HTML</th>
                        <th>PHP</th>
                          </tr>                  
                          <tr>
                            <th>C</th>
                            <th>JavaScript</th>
                          </tr>
                         
                </table>
            </body>
</html>


what is th tag  in HTML

Explain Program

Step  1] 

<!DOCTYPE html>

This declare the document type.

browser that the document is written in html

Step 2 ]

<html>.... . </html>

html is the root element of the html page.

 Every thing inside it is part of the webpage.

Step 3]

<head>.....</head>

head section contain metadata  about the webpage information 

for the browser not display on the webpage.

<title> html th tag </title>

 sets the title of page appears the browser tab

Step 4]

<body>

<h2>HTML th Tag </h2>

 <body> tag contains all the content visible on webpage.

<h2>  create heading , display HTML TH TA G 

Step 5]

 
<table>
                      <tr>
                        <th>HTML</th>
                        <th>PHP</th>
                          </tr>                  
                          <tr>
                            <th>C</th>
                            <th>JavaScript</th>
                          </tr>                        
                </table>


  •   <table> tag  creates table to organize data row and columns.
  • <tr> tag     ->    <tr> tag stands for table row    
  • <th> tag    ->   <th> tag table  header.

                   Two  Row 

  •   First row   HTML & PHP Table
  • Second row  C, Javascript Table
  • default text <th> is bold and centered.

 Step 6]

   Closing tag


 </table> 
</body>
</html>

what is th tag  in HTML

Output

html th tag

Comments

Popular posts from this blog

HTML Tag

CSS Text Color Explained with Syntax and HTML Examples

html script tag attributes

CSS text-emphasis-color Property

HTML Input Type Submit Syntax and Example

CSS Padding Property Explained

How to Display T Pattern in C with Star (*) – Step-by-Step