Labs ICT
โญ Pro Login

Paragraphs

Paragraphs are the bread and butter of web content. If headings are the titles and section markers, paragraphs are where your actual content lives โ€” the explanations, stories, descriptions, and information you want to share.

In HTML, you wrap every paragraph in a <p> tag. Simple, straightforward, easy to remember.

Writing Paragraphs

Here is how paragraphs work. Each <p> tag creates a new block of text with some space above and below it.

<p>This is the first paragraph. It has some text in it. Nothing fancy.</p>
<p>This is a second paragraph. Notice how the browser automatically adds space between them.</p>
<p>A third paragraph. You can write as many as you want.</p>
Try it Yourself โ†’

How Browsers Handle Whitespace

Here is something that confuses almost every beginner. In HTML, the browser ignores extra spaces and line breaks. If you write your paragraph across ten lines with fifty spaces, the browser smashes it all into one single line.

Watch this:

<p>This
  paragraph
    has lots
      of line breaks.</p>

When the browser renders that, it shows up as: "This paragraph has lots of line breaks." โ€” all on one line. The extra whitespace is completely ignored.

This is called whitespace collapsing. The browser collapses multiple spaces and line breaks into a single space. It is not a bug, it is by design. It lets you format your HTML code however you like without affecting how it looks on screen.

Line Breaks With br

Sometimes you want a line break inside a paragraph without starting a new paragraph. Maybe you are writing a poem, an address, or a song lyric. That is where the <br> tag comes in.

<br> is a self-closing tag โ€” it does not have a closing tag. It just tells the browser, "break the line right here."

<p>Roses are red<br>
Violets are blue<br>
HTML is fun<br>
And so are you!</p>

Use <br> sparingly. It is for line breaks, not for spacing out content. If you need more space between paragraphs, use CSS margins. If you want to separate sections, use a heading or a horizontal rule. <br> is strictly for breaking a line within the same block of text.

๐Ÿงช Quick Quiz

Which tag creates a line break?