Expand All | Collapse All

CSS text-align Property

Topic: CSS3 Properties ReferencePrev|Next


The text-align CSS property sets the horizontal alignment of the inline content like text and images in its parent block element such as heading or paragraph.

The following table summarizes the usages context and the version history of this property.

Default value: left if direction is 'ltr', right if direction is 'rtl'
Applies to: Block level elements, table cells and inline-blocks
Inherited: Yes
Animatable: No. See animatable properties.
Version: CSS 1, 2, 3


The syntax of the property is given with:

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

The example below shows the text-align property in action.

h1 {
    text-align: center;
p {
    text-align: justify;

Property Values

The following table describes the values of this property.

Value Description
left Aligns the inline text to the left.
right Aligns the inline text to the right.
center Centers the inline text.
justify The text is justified. Text line up their left and right edges to the left and right content edges of the paragraph by stretching the spaces and words.
initial Sets this property to its default value.
inherit If specified, the associated element takes the computed value of its parent element text-align property.

Browser Compatibility

The text-align property is supported in all major modern browsers.

Browsers Icon

Basic Support—

  • Firefox 1+
  • Google Chrome 1+
  • Internet Explorer 3+
  • Apple Safari 1+
  • Opera 3.5+

Further Reading

See tutorial on: CSS Text, CSS Alignment.

Text-related properties: letter-spacing, text-decoration, text-indent, text-overflow, text-shadow, text-transform, white-space, word-spacing.

Bootstrap UI Design Templates Property Marvels - A Leading Real Estate Portal for Premium Properties