<p>

Adds a paragraph to an HTML page.
2 min read
Believemy logo

The <p> tag is used in HTML to delimit a paragraph of text. It is one of the most commonly used tags for structuring textual content on a web page.

 

Structure and syntax of the <p> tag

Basic structure and syntax

The <p> tag is a container tag, which means it requires a closing tag. It is used to enclose text. Here is its basic syntax:

HTML
<p>Paragraph content</p>

It groups text or other inline elements to form a distinct paragraph.

 

Usage example

Let's take a practical example:

HTML
<p>Here is a clear and concise paragraph of text.</p>

In this example, the content is enclosed by the <p> tag, making it distinct and isolated from other elements on the page.

Try it yourself! 😉

 

Attributes

The <p> tag accepts standard HTML attributes, such as:

  • class: to apply personalized CSS styles with a class;
  • id: to identify a unique paragraph on the page;
  • style: to apply CSS styles directly to the tag.

 

Best practices

  • Use <p> to structure your textual content into distinct paragraphs (which improves readability).
  • Avoid using it for complex layouts; in such cases, prefer tags like <div>.
  • For a simple line break within a paragraph, you can use the <br> tag.

 

Difference with other similar tags

  • <br>: The <br> tag allows for a simple line break within text, whereas <p> creates a distinct paragraph.
  • <div>: Unlike <p>, the <div> tag is a generic container. It can group paragraphs, for example, as well as images, but will not add margins automatically unlike a paragraph which will add one above it by default.

 

Browser compatibility

The <p> tag is supported by all modern browsers.

BrowserCompatibility
ChromeYes
FirefoxYes
SafariYes
EdgeYes
Internet ExplorerYes

Related terms

Discover our hTML and CSS glossary

Browse the terms and definitions most commonly used in HTML and CSS development.

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.