HTML dir Attribute

 Night Mode  Light Mode

 

Definition and Usage

The dir attribute is a global attribute. It specifies the direction of element’s content.

Values :

  1. rtl : Value specifies right to left direction.
  2. ltr : Value specifies left to right direction.
  3. auto : Value specifies that the Direction will be set according the browser.

Example :

<p dir="rtl"> Direction of the text is Right to Left </p>

<p dir="ltr"> Direction of the text is Left to Right </p>

<p dir="auto"> Text direction is set according the browser </p>
Result

Direction of the text is Right to Left


Direction of the text is Left to Right


Text direction is set according the browser

 

Here are a few tutorials for you to read next:

If you find this tutorial helpful, then please Subscribe to our YouTube Channel for video tutorials, and share this article on social media.

Was this post helpful?

Leave a Comment

Your email address will not be published. Required fields are marked *