HTML Global dir Attribute

❮ Previous Global Attributes Next ❯


<p dir="rtl">Hello world</p>


The dir attribute specifies the text direction as related to the lang attribute.

The accepted values under the HTML 4.01 specification are ltr (left to right) and rtl (right to left).

It should be possible to override whatever direction a user agent sets by using this attribute with the <bdo> element

Standard Syntax

<element dir="auto|ltr|rtl">

Browser Support


Attribute Values

Value Description
auto Browser defines text direction
ltr Default. Left-to-right text direction
rtl Right-to-left text direction
❮ Previous Global Attributes Next ❯