HTML <h1> to <h6> tags

Updated: 12/30/2021 by Computer Hope
HTML h1 to h6 tags

When writing in HTML, there are six levels of headers that can be defined and inserted into your code. The <h1> to <h6> tags are block elements used to designate headings of both different sizes and importance. For example, the h1 heading is the most important and often most prominent text, and h6 is the least important.

Tip

When thinking about document structure and SEO, keep the following suggestions in mind. Every HTML page should have one H1 heading that is the first heading. Pages that need more than one heading should use the H2 - H6 headings and use them in order. For example, this page uses seven headings placed in the following order: H1, H2, H2, H3, H2, H2, and then H2.

The following sections contain information about these tags, including an example of how they're used and related attributes and browser compatibility.

Example of header code

<h3>Here is an H3 heading on Computer Hope</h3>

Example result

Here is an H3 heading on Computer Hope

Deprecated attributes

Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. Every attribute unique to the <h1 to h6> tags are deprecated, meaning that it may function currently, but is not supported in going forward. In this case, CSS should be used in place of this attribute.

Attribute Description
align Designates the alignment of the content within a heading element.

Compatibility

Edge Internet Explorer Firefox Safari Opera Chrome
All versions All versions All versions All version All versions All versions

Browser, Code, Compatibility, Container tag, <head>, Web design terms