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

Update compatibility data on GitHub
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 1
Notes
Full support 1
Notes
Notes Incorrect behavior before Firefox 23.
IE Full support 5Opera Full support ≤12.1Safari Full support 1WebView 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 4
Notes
Full support 4
Notes
Notes Incorrect behavior before Firefox 23.
Opera Android Full support ≤12.1Safari iOS Full support 1Samsung 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