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

Definition

The <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>

Paragraph Text here

Attributes

The following attributes can be used with the <p> tag.


<p> Specific Attributes
Attribute Value Description Example
There are no required or optional attributes specific to the <p> tag.
<p> Global Attributes
Attribute Description Example
Common
classSpecifies a classname for the element allowing you to apply the style of the predefined class to the content.

<p class="name">Paragraph Text</p>
idSpecifies a unique id for the element allowing you to apply the style of the predefined id to the content.

<p id="name">Paragraph Text</p>
styleSpecifies an inline style for the element allowing you to apply the style to the contentt.

<p style="color:red;">Paragraph Text</p>
titleSpecifies an inline style for the element allowing you to apply the style to the content.

<p title="Content info">Paragraph Text</p>
Keyboard
accesskeySpecifies a keyboard shortcut to associate with the element.

<p accesskey="a">Paragraph Text</p>
tabindexSpecifies a tab order for the element.

<p tabindex="1">Paragraph Text</p>
Language
dirSpecifies the directional flow of the content.

<!-- The text will flow from left to right -->
<p dir="ltr">Paragraph Text</p>
<!-- The text will flow from right to left -->
<p dir="rtl">Paragraph Text</p>
langSpecifies a language code for the content of the element.

<p lang="en">Paragraph Text</p>
spellcheckSpecifies an inline style for the element allowing you to apply the style to the contentt.

<!-- Valid values true and false. -->
<!-- Default inherited / browser specific. -->
<p spellcheck="true">Paragraph Text</p> 
translateSpecifies an inline style for the element allowing you to apply the style to the content.

<!-- Valid values yes and no. -->
<!-- Default yes. -->
<p translate="no">Paragraph Text</p> 
Miscellaneous
contenteditableSpecifies whether the content of the element is editable.

<!-- Valid values true and false. -->
<!-- Default inherited. -->
<p contenteditable="true">Paragraph Text</p> 
draggableSpecifies whether the element is draggable.

<!-- Valid values true and false. -->
<!-- Default browser specific. -->
<p draggable="true">Paragraph Text</p>
hiddenSpecifies whether the element is not yet, or no longer, relevant.

<!-- Valid values an empty string or hidden -->
<p hidden>Paragraph Text</p> 
<p hidden="hidden">Paragraph Text</p> 
<p> Event Attributes
Attribute Description Example
Document Element
oncopyThe script to be run when the user copies the content of an element.

 <!-- Executes go() function -->
<p oncopy="go()">Paragraph Text</p> 
oncutThe script to be run when the user cuts the content of an element.

 <!-- Executes go() function -->
<p oncut="go()">Paragraph Text</p>
onpasteThe script to be run when the user pastes some content into an element.

 <!-- Executes go() function -->
<p onpaste="go()">Paragraph Text</p>
Drag and Drop
ondragThe script to be run when an element is dragged.

 <!-- Executes go() function -->
<p ondrag="go()">Paragraph Text</p>
ondragendThe script to be run when an element has stopped being dragged.

 <!-- Executes go() function -->
<p ondragend="go()">Paragraph Text</p>
ondragenterThe script to be run when an element has been dragged to a valid drop target.

 <!-- Executes go() function -->
<p ondragenter="go()">Paragraph Text</p>
ondragleaveThe script to be run when an element leaves a valid drop target.

 <!-- Executes go() function -->
<p ondragleave="go()">Paragraph Text</p>
ondragoverThe script to be run when an element is being dragged over a valid drop target.

 <!-- Executes go() function -->
<p ondragover="go()">Paragraph Text</p>
ondragstartThe script to be run at the start of a drag operation.

 <!-- Executes go() function -->
<p ondragstart="go()">Paragraph Text</p>
ondropThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<p ondrop="go()">Paragraph Text</p>
Form
onblurThe script to be run when the element loses focus.

 <!-- Executes go() function -->
<p onblur="go()">Paragraph Text</p>
onchangeThe script to be run when object changed and attempt to leave field.

 <!-- Executes go() function -->
<p onchange="go()">Paragraph Text</p>
oncontextmenuThe script to be run when a context menu is triggered.

 <!-- Executes go() function -->
<p oncontextmenu="go()">Paragraph Text</p>
onfocusThe script to be run when the element gets focus.

 <!-- Executes go() function -->
<p onfocus="go()">Paragraph Text</p>
oninputThe script to be run when an element gets user input.

 <!-- Executes go() function -->
<p oninput="go()">Paragraph Text</p>
oninvalidThe script to be run when an element is invalid.

 <!-- Executes go() function -->
<p oninvalid="go()">Paragraph Text</p>
onresetThe script to be run when a dragged element is being dropped.

 <!-- Executes go() function -->
<p onreset="go()">Paragraph Text</p>
onselectThe script to be run when some or all of the contents of an object are selected.

 <!-- Executes go() function -->
<p onselect="go()">Paragraph Text</p>
onsubmitThe script to be run when a form is submitted.

 <!-- Executes go() function -->
<p onsubmit="go()">Paragraph Text</p>
Keyboard
onkeydownThe script to be run when an element is in focus and keyboard key is pressed down.

 <!-- Executes go() function -->
<p onkeydown="go()">Paragraph Text</p>
onkeypressThe script to be run when an element is in focus and keyboard key is pressed down and released.

 <!-- Executes go() function -->
<p onkeypress="go()">Paragraph Text</p>
onkeyupThe script to be run when an element is in focus and keyboard key is released.

 <!-- Executes go() function -->
<p onkeyup="go()">Paragraph Text</p>
Media
onabortThe script code to be run on abort.

 <!-- Executes go() function -->
<p onabort="go()">Paragraph Text</p>
oncanplayThe script to be run when a file has buffered enough so it is ready to start playing.

 <!-- Executes go() function -->
<p oncanplay="go()">Paragraph Text</p>
oncanplaythroughThe script to be run when a file can be played all the way to the end without further need of buffering.

 <!-- Executes go() function -->
<p oncanplaythrough="go()">Paragraph Text</p>
oncuechangeThe script to be run when the cue changes when using the track element.

 <!-- Executes go() function -->
<p oncuechange="go()">Paragraph Text</p>
ondurationchangeThe script to be run when the length of the media is changed.

 <!-- Executes go() function -->
<p ondurationchange="go()">Paragraph Text</p>
onemptiedThe script to be run when a media resource element suddenly becomes empty, usually due to an error.

 <!-- Executes go() function -->
<p onemptied="go()">Paragraph Text</p>
onendedThe script to be run when the media has reach the end.

 <!-- Executes go() function -->
<p onended="go()">Paragraph Text</p>
onloadeddataThe script to be run when media data is loaded and playback can start.

 <!-- Executes go() function -->
<p onloadeddata="go()">Paragraph Text</p>
onloadedmetadataThe script to be run when metadata has been loaded.

 <!-- Executes go() function -->
<p onloadedmetadata="go()">Paragraph Text</p>
onloadstartThe script to be run whenthe media resource has started loading.

 <!-- Executes go() function -->
<p onloadstart="go()">Paragraph Text</p>
onpauseThe script to be run when the media resource has been paused.

 <!-- Executes go() function -->
<p onpause="go()">Paragraph Text</p>
onplayThe script to be run when the media resource starts playback.

 <!-- Executes go() function -->
<p onplay="go()">Paragraph Text</p>
onplayingThe script to be run when when playback has already begun.

 <!-- Executes go() function -->
<p onplaying="go()">Paragraph Text</p>
onprogressThe script to be run when the browser is fetching the media data.

 <!-- Executes go() function -->
<p onprogress="go()">Paragraph Text</p>
onratechangeThe script to be run when the playback rate changes.

 <!-- Executes go() function -->
<p onratechange="go()">Paragraph Text</p>
onseekedThe script to be run when the seeking attribute is set to false indicating that seeking has finished.

 <!-- Executes go() function -->
<p onseeked="go()">Paragraph Text</p>
onseekingThe script to be run when the seeking attribute is set to true indicating that seeking is currently active.

 <!-- Executes go() function -->
<p onseeking="go()">Paragraph Text</p>
onstalledThe script to be run when the browser is unable to continue fetching media data.

 <!-- Executes go() function -->
<p onstalled="go()">Paragraph Text</p>
onsuspendThe script to be run when media data has stopped before being completely loaded.

 <!-- Executes go() function -->
<p onsuspend="go()">Paragraph Text</p>
ontimeupdateThe script to be run when the media resources current playback position has changed.

 <!-- Executes go() function -->
<p ontimeupdate="go()">Paragraph Text</p>
onvolumechangeThe script to be run when the volume has changed or been muted.

 <!-- Executes go() function -->
<p onvolumechange="go()">Paragraph Text</p>
onwaitingThe script to be run when the media resource has paused but is expected to resume.

 <!-- Executes go() function -->
<p onwaiting="go()">Paragraph Text</p>
Mouse
onclickThe script to be run when when a mouse is clicked on an element.

 <!-- Executes go() function -->
<p onclick="go()">Paragraph Text</p>
ondblclickThe script to be run when a mouse is double clicked on an element.

 <!-- Executes go() function -->
<p ondblclick="go()">Paragraph Text</p>
onmousedownThe script to be run when he mouse button is pressed down while the cursor is over an element.

 <!-- Executes go() function -->
<p onmousedown="go()">Paragraph Text</p>
onmousemoveThe script to be run when the mouse button is moved.

 <!-- Executes go() function -->
<p onmousemove="go()">Paragraph Text</p>
onmouseoutThe script to be run when the mouse cursor moves off an element.

 <!-- Executes go() function -->
<p onmouseout="go()">Paragraph Text</p>
onmouseoverThe script to be run when the mouse cursor moves over an element.

 <!-- Executes go() function -->
<p onmouseover="go()">Paragraph Text</p>
onmouseupThe script to be run when the mouse button is released while the cursor is over the element.

 <!-- Executes go() function -->
<p onmouseup="go()">Paragraph Text</p>
onwheelThe script to be run when the mouse wheel rolls up or down over an element.

 <!-- Executes go() function -->
<p onwheel="go()">Paragraph Text</p>
Scroll
onscrollThe script code to be run when the scrollbar of an element is being scrolled.

 <!-- Executes go() function -->
<p onscroll="go()">Paragraph Text</p> 
Window - NONE

Relevant HTML Tutorials

HTML Basics - Formatting