HTML paragraph tag

Last Updated on April 26, 2023 by Roshan Parihar

HTML <p> tag is used to specify a paragraph.

Learn how to use the HTML <p> tag with the explained examples given in this tutorial. HTML Paragraph tag contains the block of text or content of a webpage. The <p> tag also contains the left and right by default margins which you can remove by using the CSS.

HTML <p> tag

Use the opening and closing of <p> tag at the start and end of the text content. You can add as many paragraph content as you want in the single webpage.

The above syntax requires a text content to put in the opening and closing p tag. You can center align, right align or justify the paragraph using the CSS property.

Example of HTML <p> tag

Example 1
The first example contains the three paragraph content. These content also appear in the webpage the margin bottom which you can change by using the CSS margin bottom property.

Output

This is my first paragraph

This is the second paragraph

This is the third paragraph

See the above example output that displays the by default margin comes in each paragraphs.

How to add extra spaces in HTML Paragraph tag

If you want to put one extra spaces in paragraph, then you have to press space button of the keyboard. But if you want to put more than one extra space in paragraph, then you have to use &nbsp;

Output

This is my first paragraph with one space only.

This is my second  paragraph with two spaces between words second and paragraph.

This is my third   paragraph with three spaces between words third and paragraph.


Resources and References

1. W3C Specification.
2. HTML living standard
3. W3C project using Github