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>
        <title>Wikitechy HTML dir Attribute</title>
        <p dir="rtl">Welcome to></p>

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” in right to left alignment.

Browser Support for dir Attribute in HTML:

Yes Yes Yes Yes Yes

Related Searches to dir Attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.