# HTML dir Attribute

HTMLWeb DevelopmentFront End Technology

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

Live Demo

<!DOCTYPE html>
<html>
<body>
<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>
Published on 20-Jun-2019 10:55:01