W3cubDocs

/Web APIs

Document: dir property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨March 2017⁩.

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

Specification
HTML>
# dom-document-dir>

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Opera Safari Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet WebView Android WebView on iOS
dir 36
1–36Only supported for HTMLDocument, not all Document objects.
12
1Incorrect behavior before Firefox 23.
51
≤12.1–51Only supported for HTMLDocument, not all Document objects.
10.1
1–10.1Only supported for HTMLDocument, not all Document objects.
36
18–36Only supported for HTMLDocument, not all Document objects.
4Incorrect behavior before Firefox for Android 23.
47
≤12.1–47Only supported for HTMLDocument, not all Document objects.
10.3
1–10.3Only supported for HTMLDocument, not all Document objects.
3.0
1.0–3.0Only supported for HTMLDocument, not all Document objects.
37
4.4–37Only supported for HTMLDocument, not all Document objects.
10.3
1–10.3Only supported for HTMLDocument, not all Document objects.

See also

  • dir global attribute

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