Tutorials References Exercises Videos Menu
Get Certified Website NEW Pro NEW

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