HTML dir attribute

dir attribute decides the direction of text either from left to right or from right to left.

Example

<p>The direction of this paragraph is from right to left.</p>
 <p><bdo dir="rtl">This paragraph is in the reverse direction.</bdo></p>
Try </>

href attribute values

dir='rtl'

The direction is from right to left. By default, the Arabic language is from right to left.

Example

<p>The direction of this paragraph is from right to left.</p>
<p><bdo dir="rtl">This paragraph is in the reverse direction.</bdo></p>

Try</>

dir='ltr'

The direction is from left to right. By default, the English language is from left to right.

dir='auto'

It is usually used where the direction of the text is truly unknown. The text sets its direction by bidirectional algorithm.

If Arabic is written inside English language, then the Arabic inherits its direction from the English language. As a result complexities may arise. In this case, <bdi> is more appropriate.

Related Tags

This attribute can be applied on all html elements.

Specifically, this attribute can be applied on the <bdo> element.



Was this article helpful?

 

Email:

Message:

Get the newsletter