Web development

Organize an article with meaningful headings

Use headings to describe the document’s sections. A clear page heading followed by section headings helps readers scan the article and navigate it with assistive technology.

Worked example

HTML example · save as example.html and open in a browser

<main>
  <h1>Working with text files</h1>
  <section><h2>Read the input</h2><p>Choose an encoding.</p>
    <h3>Handle missing files</h3><p>Report the path clearly.</p>
  </section>
  <section><h2>Write the result</h2><p>Check the output.</p></section>
</main>

How it works

The headings form a useful outline: the h3 belongs to the reading section, and the next h2 starts a sibling section. CSS can change heading sizes without changing those relationships. This keeps appearance and document structure independently manageable.

Limits and mistakes

Do not pick heading levels just to obtain a smaller font. Bold paragraphs do not substitute for actual headings in a document outline. A heading should introduce content, not merely decorate a card or create extra spacing.

Check the result

Read only the headings and ask whether the article’s organization still makes sense. Inspect the heading list with a screen reader or accessibility tool and check for unexplained level jumps.

Sources

Reference documentation for the behavior used in this guide: