# Paragraphs & Breaks

> How HTML handles blocks of text: the paragraph, the in-content line break, the thematic divider, and why your extra spaces vanish.

Subject: HTML | Lesson 6 of 42 | 5 min read
Interactive lesson: https://codewithanimation.in/html/paragraphs-and-breaks
Previous: [Headings & the Outline](https://codewithanimation.in/html/headings-and-outline.md) | Next: [Preformatted Text & Quotes](https://codewithanimation.in/html/preformatted-and-quotes.md)

## What it is

The `<p>` element is a paragraph: a block of related text. It is block-level, so each paragraph starts on a new line and the browser puts space between one paragraph and the next for you.

Two smaller elements go alongside it. `<br>` forces a single line break inside content, and `<hr>` marks a thematic break, a shift from one topic or scene to the next. Both are void elements, so they have no closing tag.

## Why it matters

Text is most of the web, and almost everyone's first surprise is that HTML does not respect the spacing they typed. Understanding how paragraphs and breaks actually behave saves hours of fighting the page to make gaps appear.

It also sets up a habit you will use everywhere: structure belongs in HTML, and spacing belongs in CSS. Paragraphs say what the content is; styling decides how far apart it sits.

## How it works

Inside a paragraph, HTML collapses whitespace. Any run of spaces, tabs, and newlines in your source becomes a single space on the page. That is why you can indent and wrap your code neatly, and it all renders as clean flowing text, but it also means you cannot create gaps by pressing the spacebar or the Enter key.

Use `<br>` only when the line break is genuinely part of the content, like the lines of a postal address or a poem. Do not use it to push things apart or to separate paragraphs. For two distinct paragraphs, write two `<p>` elements and let spacing come from CSS.

`<hr>` represents a thematic break between sections of content, such as a change of subject. It is semantic, so it tells assistive technology that the topic shifts, not just that there is a line on screen. Its thickness, color, and spacing are all controlled with CSS.

## Common mistake: Typing extra spaces or blank lines to space things out

Coming from a word processor, it feels natural to hit the spacebar a few times or press Enter to add a gap. In HTML those extra spaces and blank lines collapse into a single space and nothing moves. Stacking `<br>` tags or empty `<p>` elements is the same trap, and the empty paragraphs even confuse screen readers. Reach for CSS `margin` when you want space.

## Tip: One idea per paragraph, spacing from CSS

Give each distinct thought its own `<p>` and let CSS `margin` set the distance between them. Keep `<br>` for line breaks that belong to the content, like an address, and use `<hr>` only for a real change of topic. If you ever reach for a break to create space, that is the signal to use CSS instead.

## Try it: Try it

On the left, a paragraph spread across messy indented lines, then an address with `<br>`, then an `<hr>`. On the right, what the browser actually renders.

The animation is on the lesson page and is not part of this text version: https://codewithanimation.in/html/paragraphs-and-breaks

## Check yourself

### Question 1

In your source you put five spaces and two blank lines between two words. What renders?

- A. A single space; the extra whitespace collapses away
- B. Exactly five spaces and two blank lines, as typed
- C. An error, because whitespace is not allowed

Correct answer: A

HTML collapses any run of spaces, tabs, and newlines into a single rendered space. To add real spacing, use CSS `margin` or `padding`, not extra whitespace.

- Why not B: HTML collapses runs of spaces, tabs, and newlines into one space.
- Why not C: Whitespace is fine; it just collapses to a single space when rendered.

### Question 2

When is <br> the right choice?

- A. For a line break that is part of the content, like a postal address
- B. To add vertical space between two sections
- C. To separate two paragraphs with <br><br>

Correct answer: A

`<br>` is for line breaks that belong to the content itself, such as an address or a line of poetry. It is not a spacing tool and should not stand in for separate paragraphs.

- Why not B: Spacing is a CSS job. `<br>` is for meaningful in-content breaks only.
- Why not C: Use two separate `<p>` elements instead; doubled `<br>` is a layout hack.

### Question 3

What does <hr> represent?

- A. A thematic break, like a shift in topic or scene
- B. Just a decorative horizontal line with no meaning
- C. A hard return that moves text to the next line

Correct answer: A

`<hr>` is a semantic thematic break between sections of content, such as a change of subject. Style its appearance and spacing with CSS; the meaning lives in the markup.

- Why not B: It is semantic: it signals a thematic change to assistive technology, not only a line.
- Why not C: That describes `<br>`. `<hr>` marks a change of theme between sections.

## Remember this

- `<p>` groups a paragraph of related content and is block-level, so each one starts on a new line.
- HTML collapses runs of spaces, tabs, and newlines into a single space; you cannot space things out with whitespace.
- Use `<br>` only for in-content line breaks like addresses or poems, never for spacing or to split paragraphs.
- `<hr>` is a semantic thematic break (a topic or scene change); control its look and spacing with CSS.
