Document.dir

You’re reading the English version of this content since no translation exists yet for this locale. Help us translate this article!

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 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 ?

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.

See also