dir Property

Internet Development Index

Sets or retrieves a value that indicates the reading order of the object.

Syntax

document.dir [ = sDir ]

Possible Values

sDirString that specifies or receives one of the following values.
ltrDefault. Content flows from left to right.
rtlContent flows from right to left.

The property is read/write. The property has a default value of ltr.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see About Dynamic Properties.

Remarks

Unless explicitly set, the dir property has no return value when accessed in script.

The dir property does not affect alphanumeric characters in Latin documents. These characters always render ltr. However, the property does affect punctuation characters in Latin documents. For example, punctuation marks such as periods and question marks will render to the left of a sentence when the dir property is set to rtl.

The value of dir property has no effect on the orientation of coordinates for an object's positioning properties. For example, the left property and the right property perform the same placement in both cases. However, when both the left and right properties are specified, the left property takes precedence when the dir property is set to ltr. Likewise, the right property takes precedence when the dir property is set to rtl.

Applies To

document

See Also

direction, HTML Character Sets