- Home
- /
- Tutorials
- /
- HTML Tutorial
- /
- HTML <h1 to h6> Tag
HTML Tags
HTML <h1 to h6> Tag
h1 to h6 are the six heading levels. h1 is the title of the page, h2 are its main sections, h3 the parts inside those, and so on. Choose the level by structure, not by how big you want the text to look.
Headings are how most people scan a page, and how screen reader users jump through it. Search engines use them to understand what each part of the page is about.
Syntax
html
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>There are no special attributes, only the global ones such as id, class, style and title. An id on a heading lets you link straight to it, like href="#pricing".
Example
html
<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>Six headings appear, each a step smaller than the one before it. Those sizes are only browser defaults; you can change any of them with CSS.
Build an outline
A page outline that makes sense
html
<h1>Learn to bake bread</h1>
<h2>Ingredients</h2>
<h2>Method</h2>
<h3>Mixing</h3>
<h3>Baking</h3>
<h2>Common problems</h2>Read just the headings and you should understand the page, like a table of contents. Do not skip levels on the way down, for example from <h2> straight to <h4>. Jumping back up, from <h3> to a new <h2>, is fine.
Browser Support
Chrome | Edge | Firefox | Safari | Opera | IE9+ |
|---|---|---|---|---|---|
| Yes | Yes | Yes | Yes | Yes | Yes |
Good to know
- Use one
<h1>per page, for the page's main title. - Never pick a heading level for its size. If an
<h2>looks too big, make it smaller with CSS. - Do not use headings to make normal text bold. Use
<strong>, or a CSS class. - Keep headings short and descriptive. "Ingredients" beats "Here is what you will need to get started".
HTML <h1 to h6> Tag exercises
Add a main heading
Add the top-level heading of a page. It says Travel guide.
Result
