Document.dir

The Document.dir property is a DOMString representing the directionality of the text of the document, whether left to right (default) or right to left. Possible values are 'rtl', right to left, and 'ltr', left to right.

Syntax

dirStr = document.dir
document.dir = dirStr

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'Document.dir' in that specification.
Living Standard Initial specification

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
dirChrome Full support 45
Notes
Full support 45
Notes
Notes Before Chrome 64, this property was accessed through the HTMLDocument alias.
Edge Full support 12Firefox Full support Yes
Notes
Full support Yes
Notes
Notes Incorrect behavior before Firefox 23.
IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support 45
Notes
Full support 45
Notes
Notes Before Chrome 64, this property was accessed through the HTMLDocument alias.
Chrome Android Full support 45
Notes
Full support 45
Notes
Notes Before Chrome 64, this property was accessed through the HTMLDocument alias.
Firefox Android Full support Yes
Notes
Full support Yes
Notes
Notes Incorrect behavior before Firefox 23.
Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support 5.0
Notes
Full support 5.0
Notes
Notes Before Samsung Internet 9.0, this property was accessed through the HTMLDocument alias.

Legend

Full support
Full support
See implementation notes.
See implementation notes.

See also

  • dir global attribute