Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Text Content  ›  Lesson

Paragraphs, Breaks, Rules and pre

p 12 minp marks a paragraph, br a line break that is part of the content, hr a change of topic, and pre text whose spacing must be kept exactly.

Paragraphs, Breaks, Rules and pre

Most of the text on the web is ordinary prose, and four small elements handle nearly all of it. Each has a precise meaning, and mixing them up is one of the most common beginner habits, like pressing Enter twice in a word processor.

The rule

p for thoughts, br for lines, hr for topic shifts, pre for exact spacing.

<p> marks a paragraph: a block of text about one idea. Browsers put space above and below each one.

<p>The ferry leaves at seven.</p>
<p>Tickets are sold on board, cash only.</p>

<br> is a line break inside a piece of content, where the break itself carries meaning, as in a poem or an address. It is a void element.

<p>12 Lake Road<br>
Udaipur 313001<br>
Rajasthan</p>

<hr> marks a thematic break: a change of topic or a scene change in a story. Browsers draw it as a horizontal line, but its meaning is "new topic", not "draw a line". It is also void.

<pre> holds preformatted text. Inside it, spaces and line breaks are kept exactly as typed, and the text is usually shown in a monospaced font. It suits ASCII art, command output and code (for code, put a <code> element inside it).

<pre>
  /\_/\
 ( o.o )
  > ^ <
</pre>

The shortcut

Ask "what is the break for?"

Choosing the right breakStep 1 of 5
  1. A new idea starts

    Close the current <p> and open a new one. Paragraphs, not stacked <br> tags.

The trap is <br><br> between blocks of text. If you need two breaks, you almost always need two paragraphs.

Why not just use <br> everywhere and skip paragraphs? Because a paragraph is a unit the browser, CSS and assistive technology all understand. You can style the space between paragraphs, screen readers can move from one to the next, and translation tools keep each one together. A wall of text broken only by <br> gives them nothing to hold on to.

Drills

Answer fast — trust the rule.

quick drill

What is the right way to separate two ideas in body text?

quick drill

Which content is the best fit for <br>?

quick drill

What does <hr> mean?

quick drill

Inside <pre>, what happens to three spaces in a row?

Remember

  • p for each idea, br for meaningful line endings, hr for a topic change, pre for exact spacing.
  • Shortcut: ask what the break is for; if the answer is "space", use CSS.
  • Trap: <br><br> between blocks instead of separate paragraphs.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainChoose the text container

You are marking up three things: a short story made of several paragraphs, a haiku whose three lines must stay separate, and an ASCII-art drawing. Say which elements you would use for each and why.