HTML <p> Tag

The <p> tag is used for paragraphs, it may contain any text content.

The <p> element should not contain tables and other block elements, it can contain just inline elements.

Syntax

The <p> tag comes in pairs. The content must be written between opening (<p>) and closing (</p>) tags.

Example

<!DOCTYPE html>
<html>
   <head>
      <title>Title of the document</title>
   </head>
   <body>
      <p>This is the example of the paragraph.</p>
   </body>
</html>

Result


This is the example of the paragraph.


The <p> has a align attribute, which is not supported in HTML 5.

Recommendation: For the text alignment use CSS text-align property.
Learn more about CSS Text.

<!DOCTYPE html>
<html>
   <head>
      <title>Title of the document</title>
   </head>
   <body>
      <p style="text-align:center;">This is the example of the paragraph which is centered.</p>
   </body>
</html>

Result


This is the example of the paragraph which is centered.


Attributes

Attribute Value Description
align right
left
justify
It was used for the alignment of the text.
This attibute is not supported in HTML5

The <p> tag also supports the Global Attributes.