NOTICE: This website is no longer updated or supported - as such many of the techniques used to build it may seem antiquated in the modern day. It is preserved for historical reasons only.

HTML XHTML The Complete Reference
home » reference » appendix a » html element reference

<p> (Paragraph)


This element is used to define a paragraph of text.

Standard Syntax


<p
align="center | justify | left | right" (transitional only)
class="class name(s)"
dir="ltr | rtl"
id="unique alphanumeric identifier"
lang="language code"
style="style information"
title="advisory text">
</p>

Attributes Defined by Internet Explorer


accesskey="key"(5.5)
contenteditable="false | true | inherit"(5.5)
disabled="false | true"(5.5)
hidefocus="true | false"(5.5)
language="javascript | jscript | vbs | vbscript"(4)
tabindex="number"(5.5)
unselectable="on | off"(5.5)

Standard Event Attributes


onclick, ondblclick, onkeydown, onkeypress, onkeyup, onmousedown, onmouseomove, onmouseout, onmouseover, onmouseup

Events Defined by Internet Explorer


onactivate, onbeforeactivate, onbeforecopy, onbeforecut, onbeforedeactivate, onbeforeeditfocus, onbeforepaste, onblur, oncontextmenu, oncontrolselect, oncopy, oncut, ondeactivate, ondrag, ondragend, ondragenter, ondragleave, ondragover, ondragstart, ondrop, onfocus, onfocusin, onfocusout, onhelp, onlayoutcomplete, onlosecapture, onmouseenter, onmouseleave, onmousewheel, onmove, onmoveend, onmovestart, onpaste, onpropertychange, onreadystatechange, onresize, onresizeend, onresizestart, onselectstart, ontimeerror

Element Specific Attributes


align

This attribute specifies the alignment of text within a paragraph. The default value is left. The transitional specification of HTML 4.01 also defines center, justify, and right. However, under the strict specification of HTML 4.01, text alignment can be handled through a style sheet rule.


Examples


<p align="right">A right-aligned paragraph</p>

<p id="para1" class="defaultParagraph"
   title="Introduction Paragraph">

 This is the introductory paragraph for a very long paper about nothing.
</p>

Compatibility


HTML 2, 3.2, 4, 4.01
XHTML 1.0, 1.1, Basic
Internet Explorer 2, 3, 4, 5, 5.5, 6
Netscape 1, 2, 3, 4, 4.5 – 4.8, 6, 7
Opera 4-7

Notes


Because p is a block element browsers typically insert a blank line, but this rendering should not be assumed, given the rise of style sheets.

Under the strict HTML and XHTML specifications, the align attribute is not supported. Alignment of text can instead be accomplished using style sheets.

The closing tag for the <p> tag is optional under the HTML specification; however, under the XHTML 1.0 specification, the closing tag </p> is required for XHTML compatibility.

As a logical element, empty paragraphs are ignored by browsers, so do not try to use multiple <p> tags in a row, like <p><p><p><p>, to add blank lines to a Web page. This will not work; use the <br> tag instead..

Remove the empty paragraph <p>&nbsp;</p> markup inserted by WYSIWYG editors.

The HTML 3.2 specification supports only the align attribute with values of center, left, and right.

The HTML 2.0 specification supports no attributes for the p element.

(X)HTML Elements
CSS Properties
Previous: option Next: param
< Home | About | Chapters | Examples | Errata | Reference | Site Map >