HTML Basics

HTML Paragraphs

The paragraph is the workhorse of text on the web. This page shows the p tag, line breaks, horizontal rules, and how browsers treat spaces.


The Paragraph Tag

The p element defines a paragraph of text. Browsers automatically add space above and below each paragraph.

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

How Browsers Handle Whitespace

HTML collapses multiple spaces and line breaks into a single space. So writing your text on several lines or adding many spaces will not change how it appears.

This all shows on one line
<p>Hello         world
and         beyond.</p>

Line Breaks and Horizontal Rules

Use <br> to force a line break within text, and <hr> to draw a thematic horizontal line between sections. Both are empty elements.

Break and rule
<p>Line one<br>Line two</p>
<hr>
<p>A new section starts here.</p>
💡

If you need to preserve exact spaces and line breaks, wrap your text in a <pre> element. It displays text exactly as typed, in a monospaced font.

Ready to use your HTML skills?

Find web development internships and fresher jobs across India.

Browse Web Dev Internships