DOM

HTMLElement.dir プロパティ

 編集:2022.10.02 by T.A.

[Edge]。→

element の内容のテキストの書字方向を取得/設定します。

HTML属性:dir

¶省く。

構文
element.dir
element HTMLElement オブジェクト。

テキストを書く方向を表す文字列。以下の何れか。

ltr 左から右へ
rtl 右から左へ
auto 要素の内容に基づいて要素の方向を決定する必要がある

HTML:

<DIV id=IdTest dir="rtl">abc def</DIV>
abc def

JavaScript:

D=IdTest.dir; //=[string]:rtl
IdTest.dir="auto";
abc def
D=IdTest.dir; //=[string]:auto

テスト