Visit Mozilla.org

CSS:text-align

From MDC

« CSS Reference

[edit] Summary

The text-align property is used to to describe how lines of text are aligned with each other. Text-align does not control the alignment of elements, only their inline content.

[edit] Syntax

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

[edit] Values

  • left : line boxes within the element line up to the left inner content edge of the paragraph
  • right : line boxes within the element line up to the right inner content edge of the paragraph
  • center : line boxes within the element are centered within the content edges of the paragraph
  • justify : line boxes within the element line up their left and right edges to the left and right content edges of the paragraph

[edit] Examples

View Live Examples

p.left { text-align: left }

p.right { text-align: right }

[edit] Notes

  • CSS2 included a <string> value that was dropped from CSS2.1 due to the lack of implementation.

[edit] Specifications

[edit] Browser compatibility

Browser Lowest Version
Internet Explorer 3
Netscape 4
Opera 3.5

[edit] See also

text-indent, text-align, text-decoration, letter-spacing, word-spacing, text-transform, white-space, white-space-collapse, text-rendering, text-wrap, text-shadow, margin (auto), margin-left (auto), margin-right (auto), vertical-align