MDN wants to learn about developers like you: https://qsurvey.mozilla.com/s3/MDN-dev-survey

この記事はまだボランティアによって 日本語 に翻訳されていません。ぜひ MDN に参加して翻訳を手伝ってください!
この記事を English (US) で読むこともできます。

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
WHATWG HTML Living Standard
The definition of 'Document.dir' in that specification.
Living Standard Initial specification

Browser compatibility

  
Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support ?(Yes) (Yes) [1] (Yes) ? ?
  
Feature Android Edge Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support ?(Yes) (Yes) [1] (Yes) ? ?

[1] Before Firefox 23, the Document.dir property returned "ltr" regardless of the setting of the dir attribute on the root <html> element. And if a direction was set on <html>, Document.dir had no effect in changing it visibly (though subsequent retrieval of the document.dir will assert that the directionality has been changed). However, if such an attribute is not set on <html> and the property is changed, both the document's visible directionality were changed and the document.dir property will correctly reflect the change.

See also

ドキュメントのタグと貢献者

 このページの貢献者: erikadoyle, teoli, Sebastianz, Brettz9, jsx, nairakhil13, Sheppy, ethertank, vali29
 最終更新者: erikadoyle,