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
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
dir | Chrome
Full support
45
| Edge Full support 12 | Firefox
Full support
Yes
| IE Full support Yes | Opera Full support Yes | Safari Full support Yes | WebView Android
Full support
45
| Chrome Android
Full support
45
| Firefox Android
Full support
Yes
| Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android
Full support
5.0
|
Legend
- Full support
- Full support
- See implementation notes.
- See implementation notes.
See also
dir
global attribute