Skip to the workspace
Pebellslearn by building
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.

html / Paragraphs, Breaks, Rules and pre

Explore each scene at your own pace.

01 · The rule

The rule

Paragraphs, Breaks, Rules and pre

p 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.

Choose paragraph, line-break, thematic-break and preformatted elements by meaning.

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>
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.