Stil textAlign Özellik
Örnek
Bir öğedeki metni ortaya hizalayın:
document.getElementById("demo").style.textAlign = "center";
Tanım ve Kullanım
textAlign özelliği, blok düzeyindeki bir öğedeki metnin yatay hizalamasını ayarlar veya döndürür.
Tarayıcı Desteği
Property | |||||
---|---|---|---|---|---|
textAlign | Yes | Yes | Yes | Yes | Yes |
Sözdizimi
textAlign özelliğini döndürün:
object.style.textAlign
textAlign özelliğini ayarlayın:
object.style.textAlign = "left|right|center|justify|initial|inherit"
Mülk değerleri
Value | Description |
---|---|
left | Aligns the text to the left. This is default |
right | Aligns the text to the right |
center | Centers the text |
justify | The text is justified |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
Teknik detaylar
Varsayılan değer: | ayrıldı |
---|---|
Geri dönüş değeri: | Öğe içindeki metnin yatay hizalamasını temsil eden bir Dize |
CSS Sürümü | CSS1 |
Daha fazla örnek
Örnek
Bir öğenin metin hizalamasını döndür:
alert(document.getElementById("demo").style.textAlign);
İlgili Sayfalar
CSS eğitimi: CSS Metni
CSS referansı: metin hizalama özelliği
❮ Stil Nesnesi