A paragraph is a block of text. In HTML, paragraphs are defined using the <p> tag. Browsers automatically add space (margin) before and after each paragraph.
Use the <p> element to define a paragraph:
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
Browser output:
This is a paragraph.
This is another paragraph.
Browsers ignore extra spaces and extra lines in HTML source code. Multiple spaces are displayed as a single space:
<p>This paragraph
has lots of
extra spaces.</p>
Browser output:
This paragraph has lots of extra spaces.
The <br> tag inserts a single line break without starting a new paragraph. It is an empty element — no closing tag needed:
<p>
This is line one.<br>
This is line two.<br>
This is line three.
</p>
Browser output:
This is line one.
This is line two.
This is line three.
The <hr> tag defines a thematic break in content and is displayed as a horizontal line. It is also an empty element:
<h2>Section One</h2>
<p>Content of section one.</p>
<hr>
<h2>Section Two</h2>
<p>Content of section two.</p>
Browser output:
Content of section one.
Content of section two.
The <pre> element displays text with preserved whitespace and line breaks exactly as written in the HTML source. Text is shown in a fixed-width (monospace) font:
<pre>
My name is John.
I am a developer.
Line one.
Line two.
</pre>
Browser output:
My name is John.
I am a developer.
Line one.
Line two.
<pre> when you need to display code, poetry, or any text where spacing and line breaks are part of the meaning.
| Tag | Description |
|---|---|
<p> | Defines a paragraph — adds spacing above and below |
<br> | Inserts a single line break (empty element) |
<hr> | Horizontal dividing line (empty element) |
<pre> | Displays text with preserved spaces and line breaks |