HTML5 <p> Tag

The HTML <p> tag is used to represents a paragraph of text. Paragraphs are usually represented in visual media as blocks of text that are separated from adjacent blocks by vertical blank space and/or first-line indentation. Paragraphs are block-level elements.

The only content permitted inside this element is phrasing content. The start tag is required for <p> elements. The end tag may be omitted if the <p> element is immediately followed by an <address>, <article>, <aside>, <blockquote>, <div>, <dl>, <fieldset>, <footer>, <form>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <header>, <hr>, <menu>, <nav>, <ol>, <pre>, <section>, <table>, <ul> or another <p> element, or if there is no more content in the parent element and the parent element is not an <a> element.

The parent of the <p> tag can be any element that accepts flow content.

The following style is applied to this element by default:

p {
  display: block;
  margin-before: 1em;
  margin-after: 1em;
  margin-start: 0;
  margin-end: 0;
}

Here are some examples of using this tag:

<p>The little kitten gently seated himself on a piece of carpet. Later in his life, this would be referred to as the time the cat sat on the mat.</p>

<fieldset>
  <legend>Personal information</legend>
  <p>
    <label>Name: <input name="n"></label>
    <label><input name="anon" type="checkbox"> Hide from other users</label>
  </p>
  <p>
    <label>Address: <textarea name="a"></textarea></label>
  </p>
</fieldset>

<p>There was once an example from Femley,<br>
Whose markup was of dubious quality.<br>
The validator complained,<br>
So the author was pained,<br>
To move the error from the markup to the rhyming.</p>

Attributes

This element only accepts global attributes.

Examples

See the Pen HTML p Tag by Tutorialio (@tutorialio) on CodePen.

Further Reading

  1. Read more about the HTML <p> element on MDN.
  2. You can also read the HTML <p> tag reference on W3C.

Reader Comments

1. You can register or login to post a comment. Asking readers to register improves the quality of discussion.

2. As a registered user, you will also get to access features like choosing between a light and dark theme or anything else that we might implement in future.

Follow Us For Updates

FacebookTwitterGoogle+
Go To Top