HTML dir Attribute
- Previous Page data-*
- Next Page draggable
- Go to Parent Level HTML Global Attributes
Definition and Usage
dir
The attribute specifies the text direction of the element content.
See Also:
HTML Tutorial:HTML attributes
CSS Reference Manual:CSS direction attribute
HTML DOM Reference Manual:HTML DOM dir attribute
HTML DOM Reference Manual:Style direction attribute
Example
A paragraph with a right-to-left text direction:
<p dir="rtl">Write this text right-to-left!</p>
Syntax
<element dir="ltr|rtl|auto">
Attribute Value
Value | Description |
---|---|
ltr | Default. Left-to-right text direction. |
rtl | Right-to-left text direction. |
auto | Let the browser determine the text direction based on the content (recommended only when the text direction is unknown). |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Previous Page data-*
- Next Page draggable
- Go to Parent Level HTML Global Attributes