Paragraph Alignment in HTML

It is possible to align paragraphs, as well as various other block elements (headings, tables or div's) with the align attribute. This is, however, deprecated in HTML5 and you should use CSS styling. The accepted values of align are: leftright, center and justify, which are pretty self-explanatory.

HTML Example:

This is centered

This is aligned right

And this is justified

Result:

This is centered

This is aligned right

And this is justified

Justified paragraphs won't be aligned to both margins unless the text is more than one line long. In the above example, the text appears as if it was aligned left.

Share

Learn how to design amazing websites