HTML dir Attribute

❮ HTML Attributes

Example

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

Meaning

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




Status




Applies to:

The dir attribute can be used on the following element:

Element Attribute
All HTML elements dir






Attribute Values

Value Description
auto Browser defines text direction
ltr Default. Left-to-right text direction
rtl Right-to-left text direction
❮ HTML Attributes