This is an important message requiring you to make a choice if you're based in the EU.

HTML <h1>-<h6> Tags

The <h1> to <h6> elements are used to define six levels of HTML Headings, with <h1> being the highest (or most important) level and <h6> the least important one.

Each web page must have only one <h1> heading. As search engines use it to index the structure and content of web documents, be sure to include keywords in it.


The <h1>-<h6> tags come in pairs, so the closing tag is required.

As the <h1> to <h6> tags are block-level elements, they always start on a new line and take up the full width available.


<!DOCTYPE html>
    <title>Title of the document</title>
    <h1>First-level heading</h1>
    <h2>Second-level heading</h2>
    <h3>Third-level heading</h3>
    <h4>Fourth-level heading</h4>
    <h5>Fifth-level heading</h5>
    <h6>Sixth-level heading</h6>


The <h1>-<h6> elements must not be used to markup subheadings, subtitles, alternative titles, and taglines unless intended to be the heading for a new section or subsection.

As the align attribute is not supported in HTML5, use the CSS font-size and font-weight properties instead.


Attribute Value Description
align left
Defines the vertical alignment of the tag content.
Not supported in HTML 5.

The <h1> to <h6> tags support the Global Attributes and the Event Attributes.

How to style <h1>-<h6> tag

Common properties to alter the visual weight/emphasis/size of text in <h1>-<h6> tag:?

  • CSS font-style property sets the style of the font. normal | italic | oblique | initial | inherit
  • CSS font-family property specifies a prioritized list of one or more font family names and/or generic family names for the selected element.
  • CSS font-size property sets the size of the font.
  • CSS font-weight property defines whether the font should be bold or thick. CSS text-transform Property controls text case and capitalization.
  • CSS text-decoration property specifies the decoration added to text, and is a shorthand property for text-decoration-line, text-decoration-color, text-decoration-style

Coloring text in <h1>-<h6> tag:

  • CSS color property describes the color of the text content and text decorations
  • CSS background-color property sets the background color of an element.

Text layout styles for <h1>-<h6> tag:

  • CSS text-indent property specifies the indentation of the first line in a text block.
  • CSS text-overflow property specifies how overflowed content that is not displayed should be signaled to the user.
  • CSS white-space property specifies how white-space inside an element is handled.
  • CSS word-break property specifies where the lines should be broken.

Other properties worth looking at for <h1>-<h6> tag

Browser support

Do you find this helpful?

Related articles