Text direction from right to left! ``` --- "> Text direction from right to left! ``` --- " />
Easy Tutorial
❮ Att Area Alt Att Basefont Size ❯

HTML dir Attribute

HTML Global Attributes

Example

A paragraph with text direction from right to left:

<bdo dir="rtl">Text direction from right to left!</bdo>

Browser Support

All major browsers support the dir attribute.


Definition and Usage

The dir attribute specifies the text direction of the element's content.


Differences Between HTML 4.01 and HTML5

In HTML5, the dir attribute can be used on any HTML element (it will validate any HTML element, but may not be useful).

In HTML 4.01, the dir attribute cannot be used on: <base>, <br>, <frame>, <frameset>, <hr>, <iframe>, <param>, and <script>.


Syntax

Attribute Values

Value Description
ltr Default. The text direction is from left to right.
rtl The text direction is from right to left.
auto Lets the browser determine the text direction based on the content. Recommended when the text direction is unknown.

HTML Global Attributes

❮ Att Area Alt Att Basefont Size ❯