HTML Paragraphs and Line breaks


What is an HTML Paragraph?

An HTML paragraph is created using the <p> tag. It defines a block of text that is visually separated from other text by spacing above and below it.

Syntax:

<p>This is a paragraph.</p>

What is an HTML Line Break?

A line break is created using the
tag. It breaks the current line and moves the following text to a new line, without starting a new paragraph.

Syntax:

Line one.<br>Line two.

Example 1: Using <p> Tags

Code:

<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>

Example 2: Using <br> for Line Breaks

Code:

<p>This is line one.<br>This is line two.</p>

Paragraphs vs Line Breaks: Key Differences

Feature <p> Paragraph <br> Line Break
Type Block-level element Inline/self-closing tag
Adds vertical space? Yes No (just moves to next line)
Starts new block? Yes No
Use case Separate topics/ideas Addresses, poems, short breaks
Closing tag needed? Yes (</p>) No

Example 3: Address Using <br>

<p>
  Jane Doe<br>
  123 Main Street<br>
  New York, NY 10001
</p>

Example 4: Poem Using <br>

<p>
Roses are red,<br>
Violets are blue,<br>
Sugar is sweet,<br>
And so are you.
</p>

Final Summary

Tag Purpose Good For
<p> Block paragraph Articles,content sections
<br> Inline line break Addresses, poetry, small breaks