html tutorial - dir Attribute in HTML - html5 - html code - html form



Dir attribute in html

Learn html - html tutorial - Dir attribute in html - html examples - html programs

  • The dir attribute specifies the text direction of the element’s content.
  • The dir attribute supports Global attributes.

Syntax for dir attribute in HTML:

<p dir=”rtl”>Text Content</p>

Applies To:

Elements Attribute
All HTML elements dir

dir Attribute Value in HTML:

Value Description
ltr Left-to-right text direction
rtl Right-to-left text direction
auto Based on the content the browser point out the text direction.

Sample Coding for dir Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
        <title>Wikitechy HTML dir Attribute</title>
    </head>
    <body>
        <p dir="rtl">Welcome to Wikitechy.com></p>
    </body>
</html>

Code Explanation for dir Attribute in HTML:

dir Attribute Code Explanation

  1. dir attribute is given for the text’s direction of the content with the value like rtl(right to left) alignment.

Output for dir Attribute in HTML:

dir Attribute Output

  1. Here the output displays the direction of the content “Welcome to Wikitechy.com” in right to left alignment.

Browser Support for dir Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to dir Attribute in html