Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS DSA TYPESCRIPT ANGULAR ANGULARJS GIT POSTGRESQL MONGODB ASP AI R GO KOTLIN SWIFT SASS VUE GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE INTRO TO PROGRAMMING BASH RUST

Web Development - HTML Paragraphs


HTML Paragraphs

Paragraphs are used to display blocks of text on a web page. In HTML, paragraphs are defined with the <p> element:

Example

Simple paragraph:

<p>This is a paragraph.</p>
Try it Yourself »

Browsers automatically add space before and after each paragraph. You don't need to add extra line breaks manually.


Multiple Paragraphs

You can add as many paragraphs as you want. Each one will start on a new line automatically:

Example

Multiple paragraphs:

<p>This is the first paragraph.</p>
<p>This is the second paragraph.</p>
<p>And this is the third paragraph.</p>
Try it Yourself »

Tip: Always enclose your text inside a paragraph tag. It helps browsers display text consistently and improves accessibility.


HTML Line Breaks

Like we mentioned in a previous chapter, if you want text to start on a new line without starting a new paragraph, use the <br> element:

Example

Using line breaks:

<p>This is the first line.<br>This is the second line.</p>
Try it Yourself »

The <br> tag is an empty element - it does not have a closing tag.


Horizontal Lines

The <hr> element defines a thematic break in the page (for example, between sections).

Example

Using a horizontal rule:

<h2>Chapter 1</h2>
<p>This is the first chapter.</p>
<hr>
<h2>Chapter 2</h2>
<p>This is the second chapter.</p>
Try it Yourself »

The <hr> tag is also an empty element and is commonly used to separate content visually.


Preformatted Text

The <pre> element displays text exactly as it is written in the HTML source, including spaces and line breaks:

Example

Using the <pre> tag:

<pre>
This text   will   keep
its spaces and
line breaks!
</pre>
Try it Yourself »

Summary

  • Use <p> for paragraphs of text.
  • Use <br> to insert line breaks inside a paragraph.
  • Use <hr> to create horizontal lines.
  • Use <pre> if you need to preserve spacing exactly.

Next, you'll learn about HTML Formatting - how to make text bold, italic, underlined, and more.

Next » HTML Formatting


×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
sales@w3schools.com

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
help@w3schools.com

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookies and privacy policy.

Copyright 1999-2025 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.