HTML Paragraphs

Paragraph element used to publish text on the web pages.

HTML Paragraphs

Paragraphs are defined with the <p> tag. Paragraph tag is very basic and typically the first tag you will need to publish your text on the web pages.

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

Note:Browsers built-in style sheets automatically create some space above and below the content of a paragraph, but you can override it using CSS.

Closing a Paragraph Element

In HTML 4 and earlier versions, it was enough to initiate a new paragraph using the opening tag. Most browsers will display HTML correctly even if you forget the end tag. For example:

  • <p>This is a paragraph.
  • <p>This is another paragraph.

The example above will work in most of the browsers, but don't rely on it. Forgetting the end tag can produce unexpected results or errors.


Note:For the purposes of forwards-compatibility and good coding practice, it's advisable to use both the opening and closing tags for the paragraphs.

HTML Line Breaks

The <br> element is used to insert a line break without starting a new paragraph.

  • <p>This is a paragraph <br> with line break.</p>
  • <p>This is <br>another paragraph <br> with line breaks.</p>

Note:Don't use empty paragraph i.e. <p></p> to add extra space in your web pages. The browser may ignore the empty paragraph since it is logical tag. Use the CSS margin property instead to adjust the spaces.

HTML Comments

Comments are usually added with the purpose of making the source code easier to understand. It may help other developer (or you in the future when you edit the source code) to understand what you were trying to do with the HTML. Comments are significant to programmers but typically ignored by browsers.

An HTML comment begins with <!--, and ends with -->, See the example below:

  • <-- This is an HTML comment -->
  • <h1>This is a heading</h1>
  • <p>This is a paragraph.</p>

HTML Spaces

Normally the browser will display the multiple spaces created inside the HTML code by pressing the space-bar key on the keyboard as one space, while multiple line breaks created through pressing the enter key also displayed as single space. Insert &nbsp; for creating extra spaces, and <br> tag to create line breaks inside your HTML document.

  • <p>multiple&nbsp;&nbsp;&nbsp;spaces.</p>
  • <p>multiple<br><br>line<br><br><br>breaks.</p>

Your Feedback:


We would love to hear from you! Please say something.