W3cubDocs

/Web APIs

Document: dir property

The Document.dir property is a string 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.

Value

A string.

Specifications

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–64Only supported for HTMLDocument, not all Document objects.
12
1Incorrect behavior before Firefox 23.
5 51
≤12.1–51Only supported for HTMLDocument, not all Document objects.
10.1
1–10.1Only supported for HTMLDocument, not all Document objects.
64
4.4–64Only supported for HTMLDocument, not all Document objects.
64
18–64Only supported for HTMLDocument, not all Document objects.
4Incorrect behavior before Firefox 23.
47
≤12.1–47Only supported for HTMLDocument, not all Document objects.
10.3
1–10.3Only supported for HTMLDocument, not all Document objects.
9.0
1.0–9.0Only supported for HTMLDocument, not all Document objects.

See also

  • dir global attribute

© 2005–2023 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