Tutorials References Exercises Menu
Paid Courses

HTML dir Attribute

Definition and Usage

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

Applies to

The dir attribute is a Global Attribute, and can be used on any HTML element.

Element Attribute
All HTML elements dir



A paragraph with a right-to-left direction:

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

Browser Support

dir Yes Yes Yes Yes Yes