Saturday , February 23 2019

HTML Headings Tags H1, H2, H3, H4, H5, H6

HTML describes total six level headings.  <h1> <h2> <h3> <h4> <h5> and <h6> tags are used to define HTML headings. <h1> is the most important tag, while <h2> is the second important tag for an HTML document. The web browser automatically implements some elements to these tags, e.g. font size, line break, margin spaces etc.

Read: What is HTML (Hypertext Markup Language)?

Read: Complete HTML Tags List

Example of HTML Headings Tags <h1> to <h6>:

Following codes shows the six different HTML headings:

<h1> A first level heading </h1>        this is most important tag

<h2> A second level heading </h2>   second important tag

<h3> A third level heading </h3>

<h4> A fourth level heading </h4>

<h5> A fifth level heading </h5>

<h6> A sixth level heading </h6>       least important tag

How to View HTML Headings in your Web Browser?

  • Open a Notepad in your computer.
  • Copy all the above codes and paste it into the Notepad window.
  • Save this file with html extension, e.g. filename.html
  • Now, double click on this file to view HTML document’s headings.


HTML Headings Tags H1 to H6

Attribute Supports:

HTML supports align attribute of <h1> to <h6>, which accepts the possible values center, left, right and justify.

<h1 align=”center”> This is heading level, 1 Center </h1>

<h2 align=”left”> This is heading level 2, Left</h2>

<h3 align=”right”> This is heading level 3, Right </h3>

<h4 align=”justify”> This is heading level 4, Justify</h4>

<h5 align=”center”> This is heading level 5, Center</h5>

<h6 align=”left”> This is heading level 6, Left</h6>

HTML Headings Tags H1 to H6 Use Align Attribute

If the align attribute doesn’t work then you can use the CSS code instead of.

CSS Codes:

<!DOCTYPE html>


<h1 style=”text-align:center”>This is heading level 1, Center</h1>

<h2 style=”text-align:left”>This is heading level 2, Left</h2>

<h3 style=”text-align:right”>This is heading level 3, Right</h3>

<h4 style=”text-align:justify”>This is heading level 4, Justify</h4>

<h5 style=”text-align:center”>This is heading level 4, Center</h5>

<h6 style=”text-align:left”>This is heading level 4, Left</h6>




HTML Headings Tags H1 to H6 Align Attribute Using CSS Code

HTML Headings Tags Importance in SEO:

Heading Tags are highly recommended by search engines, therefore, if you want to rank any keyword, then you must include it in the heading element especially in <h1> and <h2> tags.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.