
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML dir Attribute
The dir attribute in HTML is used to set the direction of content in an element.
Let us now see an example to implement the dir attribute in HTML −
Example
<!DOCTYPE html> <html> <body> <h2>Demo Heading</h2> <p>This is normal text.</p> <p dir="rtl">This text would get displayed from left to right.</p> </body> </html>
Output
In the above example, we have first set the normal text −
<p>This is normal text.</p>
After that, we have also displayed a text with direction left to right using the dir attribute −
<p dir="rtl">This text would get displayed from left to right.</p>
- Related Articles
- HTML DOM dir property
- HTML DOM Bdo dir Property
- HTML pattern Attribute
- HTML novalidate Attribute
- HTML maxlength Attribute
- HTML wrap Attribute
- HTML disabled Attribute
- HTML for Attribute
- HTML min Attribute
- HTML disabled Attribute
- HTML disabled Attribute
- HTML min Attribute
- HTML draggable Attribute
- HTML href Attribute
- HTML max Attribute

Advertisements