HTML - <h1> to <h6> Tags



HTML h1 to h6 tags are the heading tags. The HTML heading tags define six levels of heading, that is, <h1> to <h6>. where <h1> indicates the most important heading, and <h6> indicates the least important heading.

The heading tag also helps to give the title and subtitle at the top of the page or anywhere on the page. It is important to use the heading to show the document's structure.

Syntax

<h1>…</h1>
<h2>…</h2>
<h3>…</h3>
<h4>…</h4>
<h5>…</h5>
<h6>…</h6>

Attribute

HMTL h1 to h6 tags supports Global and Event attributes of HTML.

Examples of HTML h1 to h6 Tags

Here we will see the example of each heading tag. Choosing the right heading tag is importan for SEO as well as readability. keeping your website content in a strcuture form will help you to rank on google and the content will be easy to read as well.

Using h1 & h2 Tag

In the following example, we are creating an HTML page that will show the important heading of the page, i.e., the <h1> and <h2> tags.

<!DOCTYPE html>
<html>
<body>
   <h1>This is heading 1</h1>
   <h2>This is heading 2</h2>
   <h1>Tutorialspoint</h1>
</body>
</html>

Using h3 & h4 Tag

Considering the following example, where we are going to create an HTML document using the the <h3> and <h4> tags.

<!DOCTYPE html>
<html>
<body>
   <h3>This is heading 3</h3>
   <h4>This is heading 4</h4>
   <h3>Tutorialspoint</h3>
</body>
</html>

Using h5 & h6 Tag

Let's look at the following example, We are going to create HTML documents using the h5 and h6 tags indicating that the heading of the page is least important.

<!DOCTYPE html>
<html>
<body>
   <h5>This is heading 5</h5>
   <h6>This is heading 6</h6>
   <p>The above heading is h5 and h6</p>
</body>
</html>
Note: Do not use heading tags randomly, that can reduce the readability of the provided content.

Supported Browsers

Tag Chrome Edge Firefox Safari Opera
h1 - h6 Yes Yes Yes Yes Yes
html_tags_reference.htm
Advertisements