O'Reilly logo

CSS Pocket Reference, 4th Edition by Eric A. Meyer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

text-align

CSS2 values:

left | center | right | justify | <string>

CSS2.1 values:

left | center | right | justify

CSS3 values:

[ start | end | left | center | right | justify | match-parent ] || <string>

Initial value:

User agent–specific, often based on writing direction (CSS2.1); start (CSS3)

Applies to:

Block-level elements

Inherited:

Yes

Computed value:

Same as declared value

Description:

Defines 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;}

Note:

CSS2 included a <string> value that was dropped from CSS2.1 because of a lack of support but returned in CSS3. As of mid-2011, it still lacked browser support.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required