Name

text-align — NN 4 IE 4 CSS 1

Synopsis

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 by Navigator 4 and Internet Explorer 4. The value of justify is not a CSS requirement, and implementation in Version 4 browsers is spotty (see Notes).

CSS Syntax

text-align: alignment

JavaScript Equivalent

textAlign

Value

One of the four constants: center | justify | left | right.

Initial Value

Depends on browser (left in both Navigator 4 and Internet Explorer 4, but this is not a CSS requirement).

Example

P.rightHand {text-align: right}
BLOCKQUOTE {text-align: center}

Applies To

Block-level elements.

Object Model Reference

IE

[window.]document.all.elementID.style.textAlign

Notes

If you assign the justify value, text is indeed justified in Navigator 4 for the Macintosh and Internet Explorer 4 for Windows. The value is treated as the left setting in Navigator 4 for Windows and IE 4 for Macintosh.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.