text-align | NN 4 IE 4 CSS 1 |
Inherited: Yes | |
Determines the horizontal alignment of text within an element. This attribute is inherited, so it can be set for a container to impact all nested elements, such as a p element within a div element. Values of center, left, and right are supported across the board. The value of justify is not a CSS requirement; its support in Version 4 browsers is spotty (in which case it may be treated as left). But it works in IE 5 or later and Netscape 6. |
|
CSS Syntax | |
text-align: alignment
|
|
Value | |
One of the four constants: center | justify | left | right. |
|
Initial Value | |
Depends on browser language. |
|
Example | |
p.rightHand {text-align: right} blockquote {text-align: justify} |
|
Applies To | |
Block-level elements, but right-alignment also works in text-type input and textarea elements in IE 5 and later for Windows and Netscape 6. |
|
Object Model Reference | |
[window.]document.getElementById("elementID").style.textAlign
|