On this page10 sections
  1. Learning Objectives
  2. 1. Six Levels of Headings
  3. 2. Headings Are an Outline, Not a Font Size
  4. 3. Paragraphs
  5. 4. The Browser Collapses White Space
  6. 5. Dividing Sections With <hr>
  7. Common Beginner Mistakes
  8. Practice Questions
  9. Practice Answers
  10. Key Takeaways

Lecture 005: Headings & Paragraphs

Category2: Text & Styles
Lecture005 of 048
Estimated video length10 min
TargetHTML5 · any modern browser
LevelBeginner

Most of the web is text. Headings give a page its outline, the way chapter titles do in a book, and paragraphs hold the reading itself. Get these two right and your pages are easy to read, for people and for search engines.


Learning Objectives

  • Use the six heading levels <h1> to <h6> in a sensible order
  • Write paragraphs with <p>, and know when to use <br> and <hr>
  • Explain how the browser handles spaces and line breaks in text

1. Six Levels of Headings

<h1> is the most important heading and <h6> the least.

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>

2. Headings Are an Outline, Not a Font Size

Choose a heading level for its place in the outline, not for how big it looks. CSS can change the size later.

Example: a page outline:

html
<h1>Visiting Hunza</h1>

<h2>Getting there</h2>
<h3>By road</h3>
<h3>By air</h3>

<h2>Where to stay</h2>
  • Use one <h1> per page: the page's main title.
  • Don't skip levels: go <h2> → <h3>, not <h2> → <h5>.

Search engines and screen readers use this outline to understand the page.


3. Paragraphs

Each <p> is one block of text. The browser adds space above and below it automatically.

Example

html
<p>Hunza is a mountain valley in northern Pakistan.</p>
<p>It is famous for apricot blossoms in spring and golden trees in autumn.</p>

4. The Browser Collapses White Space

Inside a paragraph, any run of spaces or line breaks becomes one space.

Example

html
<p>This      text
has    lots of
     spaces    and line breaks.</p>

Run it: everything appears on one line with single spaces. To force a new line, use <br>. To show text exactly as typed, use <pre>:

html
<pre>
  Name:    Sara
  City:    Karachi
</pre>

5. Dividing Sections With <hr>

<hr> draws a horizontal line, which signals a change of topic.

Example

html
<p>That's all about spring.</p>
<hr>
<p>Now let's talk about autumn.</p>

Common Beginner Mistakes

1. Picking headings by size. Using <h4> because "h2 is too big" breaks the outline. Pick the correct level and resize with CSS.

2. Several <h1>s. Keep one main title per page.

3. Using <br><br> instead of paragraphs. Separate ideas belong in separate <p> elements.

4. Bold text instead of a heading. <p><strong>Getting there</strong></p> looks like a heading, but search engines and screen readers won't treat it as one.


Practice Questions

  1. Which heading is the most important?
  2. How many <h1> elements should a page usually have?
  3. Your page has an <h2> called "Prices". The next sub-section belongs under it. Which level should it use?
  4. Why does <p>Hello world</p> show only one space?
  5. Which element keeps the spaces and line breaks exactly as written?
  6. Write a heading "Contact" followed by two short paragraphs.

Practice Answers

  1. <h1>
  2. One.
  3. <h3>
  4. The browser collapses any run of white space into a single space.
  5. <pre>
  6. html
    <h2>Contact</h2>
    <p>Call us on 0300-1234567.</p>
    <p>We reply within one day.</p>

Key Takeaways

  • Headings <h1>–<h6> form the page outline: one <h1>, no skipped levels.
  • <p> holds one block of text; the browser spaces paragraphs for you.
  • Extra spaces collapse; use <br> for a line break or <pre> for exact layout.
  • <hr> marks a change of topic.