From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/ja/web/api/htmlelement/dir/index.html | 86 +++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 files/ja/web/api/htmlelement/dir/index.html (limited to 'files/ja/web/api/htmlelement/dir') diff --git a/files/ja/web/api/htmlelement/dir/index.html b/files/ja/web/api/htmlelement/dir/index.html new file mode 100644 index 0000000000..b8c4c2d963 --- /dev/null +++ b/files/ja/web/api/htmlelement/dir/index.html @@ -0,0 +1,86 @@ +--- +title: HTMLElement.dir +slug: Web/API/HTMLElement/dir +tags: + - API + - HTML DOM + - HTMLElement + - Property + - Reference +translation_of: Web/API/HTMLElement/dir +--- +
{{ApiRef("HTML DOM")}}
+ +

HTMLElement.dir プロパティは、現在の要素のコンテンツのテキストを書く書字方向を取得または設定します。

+ +

要素のテキストを書く書字方向 (text writing directionality) は、テキストが向かう方向です (異なる言語体系のサポートのため)。 アラビア語とヘブライ語は、 RTL 書字方向を使用する典型的な言語です。

+ +

画像の dir プロパティを "rtl" に設定できます。 この場合、HTML 属性の titlealt は、 "rtl" としてフォーマットされ、定義されます。

+ +

表の dir が "rtl" に設定されている場合、列の順序は右から左に配置されます。

+ +

要素の dir が "auto" に設定されている場合、要素の方向は、最初の明確な書字方向文字 (strong directionality character)、または既定で親要素の書字方向に基づいて決定されます。

+ +

構文

+ +
var currentWritingDirection = elementNodeReference.dir;
+elementNodeReference.dir = newWritingDirection;
+
+ + + +

dir が取り得る値は、左から右への ltr、右から左への rtl、および要素の内容に基づいて要素の方向を決定する必要があることを指定する auto です。

+ +

+ +
var parg = document.getElementById("para1");
+parg.dir = "rtl";
+// "para1" として識別される段落のテキストの方向を変更します
+
+ +

仕様書

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('HTML WHATWG', '#dom-dir', 'dir')}}{{Spec2('HTML WHATWG')}}{{SpecName('DOM2 HTML')}} からの変更はありません。
{{SpecName('DOM2 HTML', 'html.html#ID-52460740', 'dir')}}{{Spec2('DOM2 HTML')}}{{SpecName('DOM1')}} からの変更はありません。
{{SpecName('DOM1', 'level-one-html.html#ID-52460740', 'dir')}}{{Spec2('DOM1')}}初期定義
+ +

ブラウザーの互換性

+ + + +

{{Compat("api.HTMLElement.dir")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf