- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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>
Advertisements