About

The dir global attribute specifies the element's text directionality.

Syntax

The attribute is an enumerated attribute with the following keywords:

  • The ltr keyword (left-to-right text) (default)
  • The rtl keyword (right-to-left text)
  • The ttb keyword (top-to-bottom). Example: chinese
  • The auto keyword (The direction is determined programmatically using the contents of the element)

Example

ltr

The direction ltr is applied as an attribute of the blockquote HTML element

<blockquote dir=ltr>
<p>I didn't like the play, but then I saw
it under adverse conditions - the curtain was up.</p>
<cite>- Groucho Marx</cite>
</blockquote>

rtl

The direction rtl is applied using Css.

<blockquote>
<p>I didn't like the play, but then I saw
it under adverse conditions - the curtain was up.</p>
<cite>- Groucho Marx</cite>
</blockquote>
blockquote {
  direction: rtl;
}

Documentation / Reference