2.3.2.4 dir

Quirks Mode, IE7 Mode, IE8 Mode, IE9 Mode, IE10 Mode, and IE11 Mode (All Versions)

dir of type DOMString

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

Possible values are:

  • ltr – Default. Content flows from left to right.

  • rtl – Content flows from right to left.

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.

This is a DOM attribute only.

This attribute extends the HTMLDocument interface.