Encodera

Thanks for reading!

Donate to the site — we work hard for you.

HTML & CSS reference

<h1>–<h6>

Headings of six levels: `<h1>` is the main one, `<h6>` the smallest.

Syntax

<h1>Heading</h1>

Examples

Headings of different levels:

<h1>Coffee guide</h1>
<h2>Espresso drinks</h2>
<h3>Cappuccino</h3>
<p>Espresso with steamed milk foam.</p>

Change the size in CSS, keep the level by meaning:

<style>
  h2.small { font-size: 16px; text-transform: uppercase; color: gray; }
</style>
 
<h2 class="small">Latest news</h2>
<p>The level stays h2 even though it looks small.</p>

Notes

A page usually has one <h1> — its main heading. Do not skip levels: <h2> is followed by <h3>, not <h5>. Pick the level by the place in the text structure, not by the font size you want — screen readers navigate by headings and search engines rely on them.

See also

  • <p> — A paragraph of text.
  • <hgroup> — A heading together with its subtitle or tagline.
  • <section> — A thematic section of the page with its own heading.

In the tutorial

  • Headings and paragraphs — Six levels of headings, paragraphs, spaces and line breaks, the thematic break and quotes in HTML.

Thanks for reading!

Donate to the site — we work hard for you.