1. Home
  2. Computing & Technology
  3. Web Design / HTML

text-align

By Jennifer Kyrnin, About.com

text-align Description:

The text-align property defines the horizontal alignment of the text in the element.

text-align in CSS Versions:

text-align Syntax:

text-align: left | right | center | justify | inherit

  • left
    Align the text to the left side of the element.
  • right
    Align the text to the right side of the element.
  • center
    Align the text to the middle of the element.
  • justify
    Align the text so that the first and last characters are aligned with the left and right margins.
  • inherit
    The element should have the same text-align setting as the parent.

text-align Initial Value:

Depends upon the user-agent.

text-align Applies To:

All block-level elements.

text-align Inheritance:

This property is inherited.

text-align Browser Support:

text-align Examples:

Uppercase

<p style="text-align: right;>
The text in this paragraph is aligned to the right side.
</p>

text-align Special Notes:

  • Justify will change the spacing between letters or words, and user-agents handle this in different ways.

More text-align Information:

Return to the Style Library

Explore Web Design / HTML

More from About.com

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. Style Properties
  6. CSS Style Property: text-align

©2008 About.com, a part of The New York Times Company.

All rights reserved.