# Property Description

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

# Property Values

Value | Description
--- | ---
left | (default if direction=ltr) Aligns the text to the left
right | (default if direction=rtl) Aligns the text to the right
center | Centers the text
justify | Stretches the lines so that each line has equal width
inherit1 | Specifies that the value of the property should be inherited from the parent element

# Examples

This example sets the text alignment for h1 and h2 elements.

    h1 {
      text-align:center
    }

    h2 {
      text-align:left
    }

This example shows the results of setting the various text-align values:

    text-align:left
    text-align:right
    text-align:center

# Browser Support

Firefox | IE | Chrome | Opera | Safari

1 - 'inherit' not supported by IE

# Miscellaneous Information

Inherited: | Yes
Defined In: | CSS1