Summary

Heading elements implement six levels of document headings, <h1> is the most important and <h6> is the least. A heading element briefly describes the topic of the section it introduces. Heading information may be used by user agents, for example, to construct a table of contents for a document automatically.

Usage context

Permitted content Phrasing content.
Tag omission None, must have both a start tag and an end tag.
Permitted parent elements <hgroup> , or any element that can accept flow content. The <h1> element must not be a descendant of an <address> element.
Normative document HTML 5, section 4.4.6; HTML 4.01, section 7.5.5

Attributes

Like all HTML elements, these elements accept the global attributes.

The align attribute is Deprecated in HTML 4.01 and Obsolete in HTML5 .

DOM interface

This element implements the HTMLHeadingElement interface.

Examples

All headings

<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>

Above HTML will output:

Image:HTML-headers2.png

Example page

<h1>Heading elements</h1>
<h2>Summary</h2>
<p>Some text here...</p>

<h2>Examples</h2>
<h3>Example 1</h3>
<p>Some text here...</p>

<h3>Example 2</h3>
<p>Some text here...</p>

<h2>See also</h2>
<p>Some text here...</p>

Above HTML will output:

Image:HTML-headers1.png

Notes

Do not use lower levels to decrease heading font size: use the CSS font-size property instead.

Avoid skipping heading levels: always start from <h1>, next use <h2> and so on. Also try to have only one first level heading on a page.

In HTML5 , use the <section> element to define the outline of a document. Headings provide titles for sections and subsections. You can also group a heading and its content using the <div> element.

See also

Tags (3)

Edit tags

Attachments (0)

 

Attach file