You are here: Reference > HTML > attributes > dir

dir attribute

Browser support:
Sets the text direction as related to the lang attribute.
The dir attribute takes effect only on non alphanumeric characters in Latin documents, except for the bdo element. In that case, the dir attribute has effect on all characters. See the examples for details.
You can use the direction style property instead.
JavaScript page for this attribute: dir. You can find other example(s) there.

Possible values:

String that sets the direction of the text.
One of the following values:
ltr
Default. Left to right.
rtl
Right to left.
Default: ltr.

Example HTML code 1:

This example illustrates the use of the dir attribute:
<bdo dir="rtl">apple, pear, peach ...</bdo>
<br />
<bdo dir="ltr">apple, pear, peach ...</bdo>
<br />
Did you find this example helpful? yes no

Example HTML code 2:

This example illustrates the use of the dir attribute:
<span dir="rtl">apple, pear, peach ...</span>
<br />
<span dir="ltr">apple, pear, peach ...</span>
<br />
Did you find this example helpful? yes no

Supported by tags:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content