How Many Heading Tags are There in HTML?

Learn via video course
FREE
View all courses
JavaScript Course With Certification: Unlocking the Power of JavaScript
JavaScript Course With Certification: Unlocking the Power of JavaScript
by Mrinal Bhattacharya
1000
4.8
Start Learning
JavaScript Course With Certification: Unlocking the Power of JavaScript
JavaScript Course With Certification: Unlocking the Power of JavaScript
by Mrinal Bhattacharya
1000
4.8
Start Learning
Topics Covered

There are six levels in the heading tag in HTML. They have decreasing order of importance/level starting from 1 to 6. Heading tags in HTML are used to give a title or subtitle to the section on the webpage.

The font size decreases from <h1>

Syntax :

The headings are defined as <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, and as HTML heading tags are non-void elements, they must be terminated by using the same tag having a slash in front </h1>. In between the tags, the text is written, which will have different properties according to the heading selected.

Attributes

It supports tag-specific attributes such as align (center, left, right) and also includes the global attribute such as class, id, etc.

Heading Vs. Paragraph

Heading tags are of six levels starting from <h1> to <h6>. They are used to highlight the important point that we are going to learn in the content written below.

The paragraph tag is defined by using the <p>...</p> tags. The content(text) written between the opening and closing tag is shown as the paragraph to the heading. A paragraph tag is generally used for the body(content) inside the heading.

For more details, follow the Heading and Paragraph Tags in HTML article on Scaler Topics.

Heading Tags Usage

Search engines and users both use the headings to go through the website h1 should be used to show the main keyword of the webpage. Others can be used for the subheadings.

Heading tags should only be used for the title or subtitle purpose, not to make any word/sentence bold or bigger.

We should maintain the hierarchy of the level of heading tags. There should be only one h1 tag in the article, as h1 is generally used to give the main keyword to the whole content.

Multiple <h1> Elements on One Page

We can use multiple <h1> HTML tags in a webpage, but usually, it is considered to have only one h1 tag, as the h1 tag indicates the main content of the webpage and makes it look more structured.

h1 tag is the highest level heading tag that has the largest default size. So, it should be used to show the most important text(heading) of the webpage. h1 tag should be used carefully as it can also impact the SEO.

There is no strict limit to the use of the number of h1 tags. One can have multiple h1 tags and also can have nested h1 tags on a website.

Bigger Headings

Each HTML heading tag has a definite size, but that can be altered using the font-size property in the style attribute.

Output: bigger Headings

Examples

Output: Headings tags examples

Output: Heading tags example

Supported Browser

ElementChromeSafariOperaFirefox
<h1> - <h6>yesyesyesyes

Conclusion

  • There are six levels in the heading tag in HTML. They have decreasing order of importance/level starting from 1 to 6.
  • HTML heading tags are non-void elements. If they are opened, they must be closed.
  • It is recommended to have only one <h1> tag in the webpage, as it indicates the content of the webpage, and also, h1 is an important part of SEO.
  • The bigger size of the heading tag can be achieved by using the style attribute of the CSS.