--- title: dir slug: Web/HTML/Global_attributes/dir translation_of: Web/HTML/Global_attributes/dir ---
{{HTMLSidebar("Global_attributes")}}

The dir global attribute is an enumerated attribute that indicates the directionality of the element's text.

{{EmbedInteractiveExample("pages/tabbed/attribute-dir.html","tabbed-standard")}}

Он может иметь следующие значения:

Usage notes: This attribute is mandatory for the {{ HTMLElement("bdo") }} element where it has a different semantic meaning.

Browsers might allow users to change the directionality of {{ HTMLElement("input") }} and {{ HTMLElement("textarea") }}s in order to assist with authoring content. Chrome and Safari provide a directionality option in the contextual menu of input fields while Internet Explorer and Edge use the key combinations Ctrl + Left Shift and Ctrl + Right Shift. Firefox uses Ctrl/Cmd + Shift + X but does NOT update the dir attribute value.

Specifications

Specification Status Comment
{{SpecName('HTML WHATWG', "dom.html#the-dir-attribute", "dir")}} {{Spec2('HTML WHATWG')}} No change from latest snapshot, {{SpecName('HTML5.1')}}
{{SpecName('HTML5.1', "dom.html#the-dir-attribute", "dir")}} {{Spec2('HTML5.1')}} Snapshot of {{SpecName('HTML WHATWG')}}, no change from {{SpecName('HTML5 W3C')}}
{{SpecName('HTML5 W3C', "dom.html#the-dir-attribute", "dir")}} {{Spec2('HTML5 W3C')}} Snapshot of {{SpecName('HTML WHATWG')}}, from {{SpecName('HTML4.01')}} it added the auto value, and is now a true global attribute.
{{SpecName('HTML4.01', "dirlang.html#h-8.2", "dir")}} {{Spec2('HTML4.01')}} Supported on all elements but {{HTMLElement("applet")}}, {{HTMLElement("base")}}, {{HTMLElement("basefont")}}, {{HTMLElement("bdo")}}, {{HTMLElement("br")}}, {{HTMLElement("frame")}}, {{HTMLElement("frameset")}}, {{HTMLElement("iframe")}}, {{HTMLElement("param")}}, and {{HTMLElement("script")}}.

Browser compatibility

{{Compat("html.global_attributes.dir")}}

See also