The HTML <h1>
–<h6>
elements represent six levels of section headings. <h1>
is the highest section level and <h6>
is the lowest.
Content categories | Flow content, heading content, palpable content. |
---|---|
Permitted content | Phrasing content. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | Any element that accepts flow content; don't use as a child of <hgroup> element, it is now deprecated |
Permitted ARIA roles | tab , presentation |
DOM interface | HTMLHeadingElement |
Attributes
These elements include the global attributes.
The align
attribute is obsolete; don't use it.
Usage notes
- Heading information may be used by user agents, for example, to construct a table of contents for a document automatically.
- 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. - You should consider avoiding using <h1> more than once on a page. See Defining sections in Using HTML sections and outlines for more information.
Examples
All headings
The following code shows all the heading levels, in use.
<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>
Here is the result of this code:
Example page
The following code shows a few headings with some content under them.
<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>
Here is the result of this code:
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of '<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>' in that specification. |
Living Standard | |
HTML5 The definition of '<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>' in that specification. |
Recommendation | |
HTML 4.01 Specification The definition of '<h1>, <h2>, <h3>, <h4>, <h5>, and <h6>' in that specification. |
Recommendation |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | Yes | Yes | 1 | Yes | Yes | Yes |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic support | Yes | Yes | Yes | 4 | Yes | Yes | Yes |
See also
Document Tags and Contributors
Tags:
Contributors to this page:
Sheppy,
teoli,
sideshowbarker,
RokasLeng,
lreed,
erikadoyle,
slimsag,
Ende93,
TylerH,
Sebastianz,
IanRamosC,
wbamberg,
kscarfone,
jswisher,
thomaspark,
justleroy,
jenoziggy77,
ethertank,
tregagnon,
medicdude,
Potappo,
cers,
McGurk,
hobophobe,
fscholz,
PablO
Last updated by:
Sheppy,