It’s Festive Season! Enjoy 30% Off

Use code FESTIVE30 at checkout

Code has been added to clipboard!

HTML h element

Reading time 1 min
Published Jun 29, 2017
Updated Oct 2, 2019

HTML h Element: Main Tips

  • HTML defines headings in a web document by using the six HTML heading elements from <h1> to <h6>.
  • The text content of an <h1> element has a bigger font size than other heading tags. The size of the font decreases from <h1> to <h6> tags.

Heading Elements

These HTML elements set headings in a document. The h1 element is the HTML tag for largest heading. You can use h1 for the main titles, h2 element for section titles, and h3 for smaller sub-sections.

Tip: the use of headings is highly recommended since search engines use them to index websites.

Example
<h1>Heading text - Level 1. Most Important Heading</h1>
<h2>Heading text - Level 2</h2>
<h3>Heading text - Level 3</h3>
<h4>Heading text - Level 4</h4>
<h5>Heading text - Level 5</h5>
<h6>Heading text - Level 6. Least Important Heading</h6>

Note: web browsers normally add top and bottom margins to the content for every heading tag in HTML. Also, they set their text content to a bolder font.

align

It sets the horizontal alignment of the heading elements.

Tip: HTML5 does not support align. You should use CSS text-align property instead.

Example
<h1 align="center">Random text - Level 1</h1>
<h2 align="right">Random text - Level 2</h2>
<h3 align="right">Random text - Level 3</h3>
<h4 align="justify">Random text - Level 4</h4>
<h5 align="left">Random text - Level 5</h5>
<h6 align="center">Random text - Level 6</h6>

Browser support

Browser image
Chrome
All
Browser image
Edge
All
Browser image
Firefox
1+
Browser image
IE
All
Browser image
Opera
All
Browser image
Safari
All

Mobile browser support

Browser image
Chrome
All
Browser image
Firefox
4+
Browser image
Opera
All
Browser image
Safari
All