KodingKaro
HTML · Beginner · Headings, Paragraphs, and Text

Headings and paragraphs

Headings create a navigable outline, and paragraphs group prose into readable units.

✓ What you will learn in this topic

  • Explain the purpose of Headings and paragraphs in a real HTML document.
  • Choose and apply the elements shown in both examples.
  • Recognize the specific mistake described in this lesson.

Concept explanation

Use h1 through h6 to describe nested sections, not to choose visual size. A page’s main topic is usually introduced by h1; a direct subsection can use h2, and a subsection beneath it can use h3. Paragraphs group complete thoughts. The browser supplies default visual styling, but a stylesheet can change appearance without changing the meaning of the heading level.

Syntax

Choose the heading level based on how deeply its section is nested; use p for prose.

Example 1: a small page

The h2 is a subsection of the page’s h1 topic, and each p contains a separate thought.

<h1>City birds</h1>
<p>Several species visit the park each morning.</p>
<h2>Where to look</h2>
<p>Start near the pond and walk slowly.</p>

Expected result: A main heading, paragraph, subsection heading, and second paragraph appear in order.

Example 2: a practical page

The article has one topic and two sections whose headings share the same level.

<article>
  <h1>Choosing a first camera</h1>
  <section><h2>Set a budget</h2><p>Include a memory card and a spare battery.</p></section>
  <section><h2>Try it in person</h2><p>Hold the camera before you buy.</p></section>
</article>

Expected result: A self-contained article displays a clear outline with two sibling sections.

Common mistakes

Do not select heading levels to get a desired font size or use br repeatedly to create spacing.

Best practices

Use headings in logical order and choose emphasis elements according to meaning; use CSS for visual appearance.

Practice exercise

Write a short article with a main heading, two topic headings, paragraph text, one strong warning, one emphasized phrase, and a marked update.

Lesson summary

  • Headings express hierarchy; paragraphs group prose. Let CSS handle font size and spacing.
  • Use headings in logical order and choose emphasis elements according to meaning; use CSS for visual appearance.

Knowledge check

What should determine whether a heading is h2 or h3?

Show the explanation

Its place in the content outline determines the level, not the size you want it to appear.

Practical example

html
<h1>City birds</h1>
<p>Several species visit the park each morning.</p>
<h2>Where to look</h2>
<p>Start near the pond and walk slowly.</p>

Expected result:

A main heading, paragraph, subsection heading, and second paragraph appear in order.

Hands-on practice task

Write a short article with a main heading, two topic headings, paragraph text, one strong warning, one emphasized phrase, and a marked update.

In this section

Other lessons in Headings, Paragraphs, and Text

Broaden your knowledge

Related learning topics