THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML dir Attribute


Definition and Usage

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


Applies to

The dir attribute is part of the Global Attributes, and can be used on any HTML element.

Element Attribute
All HTML elements dir

Example

Example

A paragraph with a right-to-left direction:

<p dir="rtl">Write this text right-to-left!</p>
Try it Yourself »

Browser Support

Attribute
dir Yes Yes Yes Yes Yes