Name

text-align

CSS2.1 values:

left | center | right | justify | inherit

CSS2 values:

left | center | right | justify | <string> | inherit

Initial value:

User agent-specific; may also depend on writing direction.

Applies to:

Block-level elements.

Inherited:

Yes.

Computed value:

As specified.

Note:

CSS2 included a <string> value that was dropped from CSS2.1 due to a lack of support.

Description:

This property sets the horizontal alignment of text within a block-level element by defining the point to which line boxes are aligned. The value justify is supported by allowing user agents to programmatically adjust the word (but not letter) spacing of the line’s content; results may vary by user agent.

Examples:

p {text-align: justify;}
h4 {text-align: center;}

Supported by:

Firefox, Internet Explorer, Opera, Safari.

Get CSS Pocket Reference, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.