HTML <h1> to <h6> Tag

Topic: HTML5 Tags Reference« Prev|Next »

Description

The heading tags are used to define HTML headings. There are six levels of headings, from <h1> (most important) to <h6> (least important). These tags are logical block tags that's not only improves the accessibility but also aids in search engine optimization — information in higher heading levels is given more weight.

The following table summarizes the usages context and the version history of heading tags.

Placement: Block
Content: Inline and text
Start/End Tag: Start tag: required, End tag: required
Version: HTML 2, 3.2, 4, 4.01, 5

Syntax

The basic syntax of the heading tags is given with:

HTML / XHTML: <h1>...</h1> to <h6>...</h6>

The example below shows the heading tags in action.

  • <h1>Heading level 1</h1>
  • <h2>Heading level 2</h2>
  • <h3>Heading level 3</h3>
  • <h4>Heading level 4</h4>
  • <h5>Heading level 5</h5>
  • <h6>Heading level 6</h6>

Tag-Specific Attributes

The following table shows the attributes that are specific to the heading tags.

Attribute Value Description
align left
right
center
justify
Obsolete Aligns the content inside a heading element.

Global Attributes

Like all other HTML tags, the <h1> to <h6> tags supports the global attributes in HTML5.


Event Attributes

The <h1> to <h6> tags also supports the event attributes in HTML5.


Browser Compatibility

The <h1> to <h6> tags are supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 2+
  • Apple Safari 1+
  • Opera 4+

Further Reading

See tutorial on: HTML Headings, CSS Alignment.

Related tags: <p>, <div>.

 
Close

Your Feedback:

 

We would love to hear from you! Please say something.