HTML <p> tagS2C Home   « HTML <p> tag

Definition

The <p> tag and it's closing </p> tag places the enclosed content on a new line and adds a little space above and below it creating a paragraph of the enclosed content.

Example


</p>Paragraph text here</p>

Required Attributes

NONE

Optional Attributes

align - this attribute is deprecated, use CSS instead.

Common Attributes

class - specifies a classname for the element allowing you to apply the style of the predefined class to the content.


<p class="classname">Paragraph text here</p>

id - specifies a unique id for the element allowing you to apply the style of the predefined id to the content.


<p id="idname">Paragraph text here</p>

style - specifies an inline style for the element allowing you to apply the style to the content.


<p style="color:red;text-align:left">Paragraph text here</p>

title - specifies extra information about the content.


<p title="information about the content">Paragraph text here</p>

Language Attributes

dir - specifies the directional flow of the content.


<!-- The text will flow from left to right -->
<p dir="ltr">Paragraph text here</p>

<!-- The text will flow from right to left -->
<p dir="rtl">Paragraph text here</p>

lang - specifies a language code for the content of the element.


<p lang="en">Paragraph text here</p>

xml:lang - specifies a language code for the content of the element in XHTML documents.


<p xml:lang="fr">Paragraph text here</p>

Document Event Attributes

NONE

Form Event Attributes

NONE

Image Event Attributes

NONE

Keyboard Event Attributes

onkeydown - The JavaScript code to be run when an element is in focus and keyboard key is pressed.


<!-- Executes the go() function -->
<p onkeydown="go()">Paragraph text here</p>

onkeypress - The JavaScript code to be run when an element is in focus and keyboard key is pressed down and released.


<!-- Executes the go() function -->
<p onkeypress="go()">Paragraph text here</p>

onkeyup - The JavaScript code to be run when an element is in focus and keyboard key is released.


<!-- Executes the go() function -->
<p onkeyup="go()">Paragraph text here</p>

Mouse Event Attributes

onclick - The JavaScript code to be run when a mouse is clicked on the element.


<!-- Executes the go() function -->
<p onclick="go()">Paragraph text here</p>

ondblclick - The JavaScript code to be run when a mouse is double clicked on the element.


<!-- Executes the go() function -->
<p ondblclick="go()">Paragraph text here</p>

onmousedown - The JavaScript code to be run when the mouse button is pressed down while the cursor is over the element.


<!-- Executes the go() function -->
<p onmousedown="go()">Paragraph text here</p>

onmousemove - The JavaScript code to be run when the mouse button is moved.


<!-- Executes the go() function -->
<p onmousemove="go()">Paragraph text here</p>

onmouseout - The JavaScript code to be run when the mouse cursor moves off an element.


<!-- Executes the go() function -->
<p onmouseout="go()">Paragraph text here</p>

onmouseover - The JavaScript code to be run when the mouse cursor moves over an element.


<!-- Executes the go() function -->
<p onmouseover="go()">Paragraph text here</p>

onmouseup - The JavaScript code to be run when the mouse button is released while the cursor is over the element.


<!-- Executes the go() function -->
<p onmouseup="go()">Paragraph text here</p>

go to home page Homepage go to top of page Top