Categories
Web development

HTML dir Attribute

HTML dir Attribute

The HTML dir attribute defines the text direction of the element’s content.

Syntax:

<element dir="ltr|rtl|auto"> 

ltr (default) – left-to-right text direction.

rtl – right-to-left text direction.

auto – the browser decides the text direction based on the content (only recommended if the text direction is unknown).

Example:

<!doctype html>
<html>
<body>
    <p dir="rtl">This is a paragraph.</p>
</body>
</html>

Output:

This is a paragraph.



Enjoy coding!

Read also:

HTML Attributes

HTML Basics

HTML Media