HTMLElement: dir property - Web APIs | MDN (original) (raw)

Value

One of the following:

"ltr"

Left-to-right writing direction.

"rtl"

Right-to-left writing direction.

"auto"

The direction of the element must be determined based on the contents of the element.

""

The default value; the directionality is inherited from the parent element.

Examples

const para = document.getElementById("para1");
para.dir = "rtl";
// change the text direction on a paragraph identified as "para1"

Specifications

Specification
HTML # dom-dir

Browser compatibility

See also