Style direction attribute
- Forrige side cursor
- Næste side display
- Gå tilbage til forrige niveau HTML DOM Style Object
Definition and usage
direction
Sets or returns the text direction (reading order) of the element content.
See also:
CSS tutorial:CSS tekst
CSS reference manual:Direction attribute
HTML reference manual:HTML dir egenskab
HTML DOM reference manual:HTML DOM dir attribute
Instance
Example 1
Sets the text direction of the <p> element to "from right to left":
document.getElementById("myP").style.direction = "rtl";
Example 2
Returns the text direction of the <p> element:
alert(document.getElementById("myP").style.direction);
Syntax
Return direction attribute:
object.style.direction
Set direction attribute:
object.style.direction = "ltr|rtl|initial|inherit"
Property value
Value | Description |
---|---|
ltr | Text flows from left to right. Default. |
rtl | Text flows from right to left. |
initial | Sets this property to its default value. See initial. |
inherit | Inherits this property from its parent element. See inherit. |
Technical details
Default value: | ltr |
---|---|
Return value: | A string that represents the text direction of the element. |
CSS version: | CSS2 |
Browser supports
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
- Forrige side cursor
- Næste side display
- Gå tilbage til forrige niveau HTML DOM Style Object