Skip to: content, navigation

by Ian Lloyd

dir (HTML attribute)

Spec
Depr. Version
No HTML 4
Browser support full matrix
IE5.5+ FF1+ Saf3+ Op9.2+
Full Full Full Full
dir=" { ltr | rtl } "

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>

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.

Value

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

Compatibility

IE5.5Full
6.0Full
7.0Full
Firefox1.0Full
1.5Full
2.0Full
Safari1.3None
2.0None
3.0Full
Opera9.2Full
9.5Full

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

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters