Appearance
HTML provides six levels of headings, from <h1> to <h6>, that indicate the hierarchy and importance of the content.
It is important that headings should be used in a subsequent order.
<h1>
The <h1> tag is the most prominent and should be used only once per page, usually for the main title. Of the document.
<h2> to <h3>
The <h2> to <h6> elements are used for subheadings with, in most cases, decreasing font size.
You can use these elements to divide your content into sections and subsections, following a subsequent order and structure.
Heading with subtitle
If you want to add a subtitle to your heading, the best practice is to wrap your heading and a <p> for the subtitle in a <header> element.
Example
HTML
<header>
<h2>Heading</h2>
<p>Subtitle</p>
</header>Do's and dont's
Do
- Alway use one
<h1>. Use it to define the documents main title. - Always use headings in a subsequent and logical order.
Don't
- Never use an other heading element to style the heading. Use CSS styles and make sure that the headings are in a logical order.
- Don't skip heading levels. For example, don't jump from a h2 to a h4, skipping a h3 element.