HTMLElement: dir property - Web APIs | MDN (original) (raw)
Value
One of the following:
Left-to-right writing direction.
Right-to-left writing direction.
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
- document.dir
- HTML dirglobal attribute
- CSS direction property
- CSS :dir pseudo-class