शैली पाठसंपत्ति संरेखित करें
उदाहरण
किसी तत्व में टेक्स्ट को केंद्र-संरेखित करें:
document.getElementById("demo").style.textAlign = "center";
परिभाषा और उपयोग
टेक्स्ट एलाइन गुण ब्लॉक स्तर के तत्व में टेक्स्ट के क्षैतिज संरेखण को सेट या लौटाता है।
ब्राउज़र समर्थन
Property | |||||
---|---|---|---|---|---|
textAlign | Yes | Yes | Yes | Yes | Yes |
वाक्य - विन्यास
टेक्स्ट एलाइन संपत्ति लौटाएं:
object.style.textAlign
टेक्स्ट एलाइन संपत्ति सेट करें:
object.style.textAlign = "left|right|center|justify|initial|inherit"
सम्पत्ति की कीमत
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 |
टेक्निकल डिटेल
डिफ़ॉल्ट मान: | बाएं |
---|---|
प्रतिलाभ की मात्रा: | एक स्ट्रिंग, तत्व के भीतर पाठ के क्षैतिज संरेखण का प्रतिनिधित्व करता है |
सीएसएस संस्करण | सीएसएस 1 |
और ज्यादा उदाहरण
उदाहरण
किसी तत्व का टेक्स्ट संरेखण लौटाएं:
alert(document.getElementById("demo").style.textAlign);
संबंधित पृष्ठ
सीएसएस ट्यूटोरियल: सीएसएस टेक्स्ट
सीएसएस संदर्भ: टेक्स्ट-संरेखित संपत्ति
❮ स्टाइल ऑब्जेक्ट