HTML heading tags
The <h1> - <h6> tags are used to display headings on a webpage. The smaller the number in the tag, the bigger the heading.
Heading tags: <h1> (biggest heading), <h2>, <h3>, <h4>, <h5>, <h6> (smallest heading)
NOTE: The browser will automatically place a line break before and after each heading.
Attributes
| Attribute | Possible values | Description |
|---|---|---|
| align | left, right, center, justify | Sets how a heading will be aligned.
NOTE: This attribute is deprecated. |
Standard attributes
class, dir, id, lang, style, title, xml:lang
For more information on standard attributes, check out our HTML standard attributes reference page.
Event attributes
onclick, ondblclick, onmousedown, onmousemove, onmouseout, onmouseover, onmouseup, onkeydown, onkeypress, onkeyup
For more information on event attributes, check out our HTML event attributes reference page.
Example
Text in a small heading
Bigger heading
Even bigger heading
Another heading
And another heading
The biggest heading
Tips & notes
Headings should be used to present the logical order of a document and used in order - <h1> as a main heading, then <h2>, then <h3>, and so on. Our pages are an example of this - we have the title of the page in an <h1> heading, and the title for each part of the page (subtitles) in an <h2> heading. Do not use headings to simply display text in a certain size.
Using headings is good for search engines - they use use headings to index your structure and content, and for your visitors - many internet users don't really read pages, they skim through them. Properly placed headings are a good way to catch the users eye so they know what's where on the page and this way its easier for them to find what they're looking for.