HTML <p> Tag

The <p> tag defines an HTML paragraph. A paragraph is a distinct section of text with spacing before and after the text - just a like a paragraph in an book.

HTML Tag

Example

#

A <p> tag.
It contains an article about Wang Ximeng, a Chinese painter.

Wang Ximeng (1096–1119) was a Chinese painter during the Song Dynasty, in the early twelfth century. A prodigy, Wang was one of the most renowned court painters of the Northern Song period, and was taught personally by Emperor Huizong of Song himself. He died at the age of 23.

<p>
  Wang Ximeng (1096–1119) was a Chinese painter 
  during the Song Dynasty, in the early twelfth century. 
  A prodigy, Wang was one of the most renowned court 
  painters of the Northern Song period, and was taught 
  personally by Emperor Huizong of Song himself. 
  He died at the age of 23.
</p>
p = paragraph

Using <p>

The <p> tag creates an HTML paragraph, i.e. a distinct section of text.

Paragraphs are block-level elements with line-breaks before and after.

This element usually contains text with inline-elements, such as, <span>, <b>, <em> or <code>.

More Examples

An <article> with a couple paragraphs and an image.
The article is about Chinese historic art.

A Thousand Li of Rivers and Mountains

Wang's only surviving work is an 11.9 metres (39 ft) long scroll titled A Thousand Li of Rivers and Mountains. The painting, finished by Wang when he was only 18 in 1113, was one of the largest in Chinese history, and has been described as one of the greatest works of Chinese art. The painting is in the permanent collection of the Palace Museum in Beijing.

Chinese landscape paintings are read, meaning they are viewed, from right to left. But recently scholars state that this painting should be viewed as the whole panorama. Perhaps, he used the technique of "Chinese occlusion" and the use of green and blue colors of Tang for creating of huge landscapes. The large piece of silk painting should be laid on the old, time-worn wall. Looking through it at dawn or in the evening an artist could see landscapes that later he would depict in his own painting

<article>
  <h2>A Thousand Li of Rivers and Mountains</h2>
  <p>
    Wang's only surviving work is an 11.9 metres (39 ft) 
    long scroll titled A Thousand Li of Rivers and Mountains. 
    The painting, finished by Wang when he was only 18 
    in 1113, was one of the largest in Chinese history, 
    and has been described as one of the greatest works of 
    Chinese art. The painting is in the permanent collection 
    of the Palace Museum in Beijing.
  </p>
  <p>
    Chinese landscape paintings are read, meaning they are 
    viewed, from right to left. But recently scholars state 
    that this painting should be viewed as the whole panorama.
    Perhaps, he used the technique of "Chinese occlusion" and 
    the use of green and blue colors of Tang for creating of huge 
    landscapes. The large piece of silk painting should be laid 
    on the old, time-worn wall. Looking through it at dawn or 
    in the evening an artist could see landscapes that later 
    he would depict in his own painting
  </p>
  <div>
    <img src="/img/html/thousand-li.jpg" style="padding:20px 0;">
  </div>
</article>

Attributes for <p>

The <p> element has no attributes, but it does accept global attributes.
The following are commonly used.

Attribute Value Description
id    identifier Defines a unique identifier for the paragraph.
class    classnames Sets one or more CSS classes to be applied to the paragraph.
style    CSS-styles Sets the style for the paragraph.
lang    language Sets the language for the paragraph.

For additional global attributes see our global attributes list.


Obsolete Attributes

Do not use the attribute listed below.  It is no longer valid on the p tag in HTML5.

Attribute Description Alternative
align Aligns the content of the paragraph. CSS text-align

Did you know?

Did you know?

Paragraph text can be aligned to 'justify'

By default, the text in a paragraph is left aligned.

The alignment can be set to justify with the CSS property text-align.

When text is justified, all lines have the same width. This is commonly used in book printing.

A justified paragraph. All lines have the same width.

The Palace Museum is a national museum housed in the Forbidden City at the core of Beijing, China. It was established in 1925 after the last Emperor of China was evicted from his palace, and opened its doors to the public.

<p style="text-align:justify;width:300px;">
    The Palace Museum is a national museum housed in 
    the Forbidden City at the core of Beijing, China. 
    It was established in 1925 after the last Emperor 
    of China was evicted from his palace, and opened 
    its doors to the public.
</p>

Text Tags

The <p> tag is part of a group of tags that are used to create and format text documents. This group is referred to as the Text tag group. Together, these tags allow you to create comprehensive HTML text documents.

Here is a list of text tags.

Element Description
<h1>-<h6> Defines text headings in 6 different sizes
<p> Creates a paragraph
<span> Container for one or more inline text elements
<br> Creates a line break
<sup> Specifies superscript text
<sub> Specifies subscripted text
<u> Specifies underlined text
<i> Specifies italic text
<b> Specifies bold text
<em> Marks text that needs emphasis
<strong> Indicates text that is important or with high urgency
<del> Defines deleted text
<ins> Defines inserted text
<ruby> Represents a small annotation with pronunciation of text
<kbd> Specifies keyboard input, such as, CTRL or ALT
<wbr> Specifies a preferred word-break location for long words

Browser support

Here is when <p> support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

Guides