HTML <p> alignAttribute

HTML p 标签参考手册HTML <p> tag

Example

A right-aligned paragraph:

<p align="right">This paragraph is right-aligned.</p>

Try it yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the align attribute.


Definition and Usage

HTML5 does not support the <p> align attribute. Use CSS instead.

In HTML 4.01, the align attribute of <p> isdeprecated。

The align attribute specifies the alignment of text within a paragraph.


Compatibility Notes

In HTML 4.01, the align attribute of <p> is deprecated. Use CSS instead.

CSS syntax: <p style="text-align:right">

CSS example: Align text in a paragraph

In our CSS tutorial, you can find more details about thetext-align propertydetails.


Syntax

<p align="left|right|center|justify">

Attribute Values

Value Description
left Left-aligns the text.
right Right-aligns the text.
center Center-aligns the text.
justify Stretches the lines so that each line has equal width (like in newspapers and magazines).


HTML p 标签参考手册HTML <p> tag Other Extensions