Směr stylu Vlastnost
Příklad
Nastavte směr textu prvku <p> na „zprava doleva“:
document.getElementById("demo").style.direction = "rtl";
Definice a použití
Vlastnost direction nastavuje nebo vrací směr textu (pořadí čtení) obsahu prvku.
Podpora prohlížeče
Property | |||||
---|---|---|---|---|---|
direction | Yes | Yes | Yes | Yes | Yes |
Syntax
Vraťte vlastnost direction:
object.style.direction
Nastavte vlastnost direction:
object.style.direction = "ltr|rtl|initial|inherit"
Hodnoty vlastností
Value | Description |
---|---|
ltr | Text flows from left to right. This is default |
rtl | Text flows from right to left |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Technické údaje
Výchozí hodnota: | ltr |
---|---|
Návratová hodnota: | Řetězec představující směr textu prvku |
Verze CSS | CSS2 |
Další příklady
Příklad
Vraťte směr textu prvku <p>:
alert(document.getElementById("demo").style.direction);
Související stránky
CSS tutoriál: CSS Text
CSS reference: vlastnost direction
HTML reference: HTML dir Atribut
HTML DOM reference: HTML DOM dir Property
❮ Objekt stylu