Arah gaya Properti
Contoh
Setel arah teks elemen <p> ke "kanan-ke-kiri":
document.getElementById("demo").style.direction = "rtl";
Definisi dan Penggunaan
Properti direction menetapkan atau mengembalikan arah teks (urutan bacaan) dari konten elemen.
Dukungan Peramban
Property | |||||
---|---|---|---|---|---|
direction | Yes | Yes | Yes | Yes | Yes |
Sintaksis
Kembalikan properti arah:
object.style.direction
Setel properti arah:
object.style.direction = "ltr|rtl|initial|inherit"
Nilai properti
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 |
Detail Teknis
Nilai Bawaan: | ltr |
---|---|
Nilai Kembali: | Sebuah String, mewakili arah teks dari sebuah elemen |
Versi CSS | CSS2 |
Lebih Banyak Contoh
Contoh
Kembalikan arah teks dari elemen <p>:
alert(document.getElementById("demo").style.direction);
Halaman Terkait
Tutorial CSS: Teks CSS
Referensi CSS: properti arah
Referensi HTML: Atribut dir HTML
Referensi HTML DOM: HTML DOM dir Properti
Objek Gaya