dir (HTML attribute)

Spec
Depr. Version
No HTML 4
Browser support (more…)
IE5.5+ FF1+ SA3.1+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

dir=" { ltr | rtl } "

Description

The bdo element on its own doesn’t do an awful lot—it’s basically useless without the dir attribute, a required attribute, to set the direction in which text should render, regardless of the order of text in the parent containers.

Example

Here, the direction is set to right-to-left:

<p>The sequence was reversed as <bdo dir="rtl">1-2-3-4-5</bdo></p>

Value

There are only two possible values for dir: "ltr" or "rtl".

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Full Full Full Full Full Full Full Full Full None None Full Full Full Full Full Full

With the exception of Safari 1.3 and 2, all browsers reverse the text properly, including nested bdo elements where the outer bdo specifies one direction, and the inner bdo specifies the opposite direction.

User-contributed notes

Related Products