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 |
|---|
| HTML Standard (HTML) # dom-document-dir |
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
dir |
64
1-64
Only supported for
HTMLDocument, not all Document objects. |
12 |
1
Incorrect behavior before Firefox 23.
|
5 |
51
≤12.1-51
Only supported for
HTMLDocument, not all Document objects. |
10.1
1-10.1
Only supported for
HTMLDocument, not all Document objects. |
64
1-64
Only supported for
HTMLDocument, not all Document objects. |
64
18-64
Only supported for
HTMLDocument, not all Document objects. |
4
Incorrect behavior before Firefox 23.
|
47
≤12.1-47
Only supported for
HTMLDocument, not all Document objects. |
10.3
1-10.3
Only supported for
HTMLDocument, not all Document objects. |
9.0
1.0-9.0
Only supported for
HTMLDocument, not all Document objects. |
See also
-
dirglobal attribute
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/dir