CSS Property - Text Align

Value: left | right | center | justify
Initial: UA specific
Applies to: block-level elements
Inherited: yes
Percentage values: N/A

The CSS property "text-align" describes how text is aligned within the element. The actual justification algorithm used is UA and human language dependent.


p{text-align: left;}

Result: Default Setting: Text Align Left

p{text-align: right;}

Result: Text is aligned right

p{text-align: center;}

Result: Text is aligned in the center of the element

Note that alignments are relative to the width of the element, not the canvas. If "justify" is not supported, the UA will supply a replacement. Typically, this will be "left" for western languages.

CSS1 core: UAs may treat "justify" as "left" or "right", depending on whether the element"s default writing direction is left-to-right or right-to-left, respectively.