Description »

Specifies the horizontal alignment of text in an element.

Browser Compatibility

Possible Values »

  • text-align: left;
  • The default value. Text is aligned to the left.
  • text-align: right;
  • Text is aligned to the right.
  • text-align: center;
  • Text is centered.
  • text-align: justify;
  • Spacing is adjusted on each line to assure that each line is aligned to both the right and left. Each line of text (except the last) will have equal length.
  • text-align: inherit;
  • The text alignment is inherited from the parent element.

Details »

This property simply determines how text in an element is aligned. For visual representation, the following shows how the four main values relate to the symbols on a Word palette:

Left Center Right Justify

In Practice »

Results CSS
Try it! at The CSS Zone Sandbox
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License