p tag (HTML 4.01)
paragraphThe p, short for paragraph, tag does exactly what the name implies: It creates a paragraph of text, and should be used when displalying substantial amounts of text on a webpage. The amount of space between paragraphs is up to the browser, but it seems to be some what standardized. Here is an example:
<p>This is the first paragraph.</p> <p>This is the second paragraph.</p>
The result simply looks like this:
This is the first paragraph.
This is the second paragraph.
The align attribute
The align attribute allows you to specify how the text within the paragraph should be aligned. You can click on the link to see the possible values. Here's an example where we have aligned the text to the right:
Text aligned to the right!
However, the align attribute has been deprecated. You can achieve the exact same effect with CSS though, using the text-align property.
Attributes
| Attribute | Deprecated | Required | Description |
|---|---|---|---|
| align | X | align, text alignment | |
| class | space-separated list of classes | ||
| dir | direction for weak/neutral text | ||
| id | document-wide unique id | ||
| lang | language code | ||
| style | associated style info | ||
| title | advisory title |
Events
| Event | Description |
|---|---|
| onclick | a pointer button was clicked |
| ondblclick | a pointer button was double clicked |
| onkeydown | a key was pressed down |
| onkeypress | a key was pressed and released |
| onkeyup | a key was released |
| onmousedown | a pointer button was pressed down |
| onmousemove | a pointer was moved within |
| onmouseout | a pointer was moved away |
| onmouseover | a pointer was moved onto |
| onmouseup | a pointer button was released |