HTML Headings

HTML Headings

In HTML, a heading tag is used to create a heading or a subheading for a section of content on a web page. The heading tag is denoted by the “h” letter followed by a number, where the number represents the level of importance or hierarchy of the heading.

The following are the six levels of heading tags in HTML:

  1. <h1> - the most important heading tag, typically used for the title of the page
  2. <h2> - used for main headings on the page
  3. <h3> - used for subheadings
  4. <h4> - used for sub-subheadings
  5. <h5> - used for minor headings
  6. <h6> - used for the least important headings


<h1>Heading no. 1</h1>  
<h2>Heading no. 2</h2>  
<h3>Heading no. 3</h3>  
<h4>Heading no. 4</h4>  
<h5>Heading no. 5</h5>  
<h6>Heading no. 6</h6> 

live preview

Heading no. 1

Heading no. 2

Heading no. 3

Heading no. 4

Heading no. 5
Heading no. 6

Here’s an example of how the <h1> and <h2> tags might be used:

<!DOCTYPE html>
    <title>My Web Page</title>
    <h1>Welcome to My Web Page</h1>
    <p>This is my first paragraph.</p>
    <h2>About Me</h2>
    <p>This is some information about me.</p>
    <h2>My Hobbies</h2>
    <p>These are my favorite hobbies.</p>



In this example, the <h1> tag is used for the main title of the page, while the <h2> tag is used for the subheadings “About Me” and “My Hobbies”.

It is important to use heading tags properly in HTML for both accessibility and SEO (search engine optimization) purposes. Proper use of heading tags can help users understand the structure and hierarchy of the content on a web page and can also help search engines understand the main topics and themes of a page.

HTML Attribute
HTML Paragraph