Lesson 5 of 36
HTML Tutorial

Headings and Paragraphs

Build a clear outline with h1 to h6, write paragraphs, and use line breaks sparingly.

3 min readBeginnerWeb FundamentalsHTML Basic Tags

Most of a web page is text, and text needs structure. Headings give a page its outline and paragraphs hold the sentences. In this lesson we mark up the "About" page of the Brew and Byte cafe.

Headings#

HTML has six heading levels, from <h1> (most important) to <h6> (least important):

html
<h1>About Brew and Byte</h1>
<h2>Our story</h2>
<h2>Our coffee</h2>
<h3>Where the beans come from</h3>
<h3>How we roast</h3>
<h2>Visit us</h2>

Think of them as the chapters and sub-chapters of a book. Rules of thumb:

  • Use one <h1> per page: the main topic. It is usually the page title.
  • Do not skip levels. Go from <h2> to <h3>, never from <h2> straight to <h5>.
  • Choose a level for its position in the outline, not for its size. Size is a job for CSS.

Why does this matter? Screen reader users often navigate by pressing a key to jump between headings, a bit like scanning a table of contents. A tidy outline gets them where they want quickly. Search engines also read headings to understand your page.

Paragraphs#

The <p> element holds a paragraph of text. Browsers add space above and below each one.

html
<p>Brew and Byte opened in 2021 in a converted bookshop.</p>
<p>We serve single-origin coffee, fresh bread and plenty of power sockets.</p>

Each paragraph begins on a new line and occupies the full width available. Never use empty paragraphs (<p></p>) to create space; use CSS margins instead.

Line breaks#

Sometimes you need a line break inside a paragraph, such as in a postal address or a line of poetry. That is the job of <br>, a void element:

html
<p>
  Brew and Byte<br>
  12 Lakeside Road<br>
  Pokhara
</p>

Without <br>, the three lines would join into one, because browsers collapse the line breaks you type in the source (more on that in a later lesson).

Headings versus bold text#

A common beginner shortcut is to make a heading by wrapping text in bold and enlarging it. To a sighted visitor it may look right, but to a screen reader and a search engine it is an ordinary paragraph. Always use a heading element for headings, then restyle it with CSS if you dislike the default look.

Common mistakes#

  • Using several <h1> elements or none at all.
  • Picking <h4> because it "looks the right size".
  • Using empty paragraphs or strings of <br> for vertical spacing.
  • Putting headings inside paragraphs. A heading is its own block.
  • Leaving a heading empty, which confuses assistive technology.

Try it yourself#

Mark up this outline for a portfolio page: a page title "Priya Sharma, Web Developer", then sections "About me", "Projects" (with sub-sections "Cafe website" and "Recipe app") and "Contact". Add a short paragraph under each heading. Finally write a three-line address inside one paragraph using <br>. Check that you never skipped a heading level.

Recap#

Use h1 to h6 to build a logical outline, with a single h1. Use p for paragraphs and br only for line breaks that belong inside the text itself, like an address. Leave size and spacing to CSS.

Check your understanding

Lesson quiz

Optional

A short quiz to check what you just learned.

Questions
4
Time limit
5 min
Pass mark
70%
Best score
-