← Web basics: HTML, CSS and JavaScript

Headings

h1 to h6 build an outline of your page.

Start this lesson

HTML has six heading levels, <h1> to <h6>. They are not about size: they describe the outline of the page, like chapter and section titles in a book. A page usually has one <h1> for its main title, <h2> for its main sections, and <h3> for parts inside a section. People using screen readers often jump from heading to heading to find what they need, and search engines use headings to understand the page, so a clean outline helps everyone.

<h1>Lemon Rice</h1>
<h2>Ingredients</h2>
<p>Rice, lemon, peanuts, curry leaves.</p>
<h2>Steps</h2>
<h3>Cook the rice</h3>
<h3>Mix and season</h3>

One h1 for the recipe name, h2 for the two big sections, h3 for steps inside the Steps section. Read only the headings and you already understand the page.

Do not pick a heading level because of how big it looks. If you want a smaller or larger heading, keep the right level and change its size with CSS later.

Try not to skip levels going down: after an h2, the next smaller heading should be h3, not h5.