نص النمط محاذاة الخاصية
مثال
مركز محاذاة النص في عنصر:
document.getElementById("demo").style.textAlign = "center";
التعريف والاستخدام
تقوم الخاصية textAlign بتعيين أو إرجاع المحاذاة الأفقية للنص في عنصر مستوى الكتلة.
دعم المتصفح
Property | |||||
---|---|---|---|---|---|
textAlign | Yes | Yes | Yes | Yes | Yes |
بناء الجملة
قم بإرجاع خاصية textAlign:
object.style.textAlign
قم بتعيين خاصية 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 |
تفاصيل تقنية
القيمة الافتراضية: | اليسار |
---|---|
قيمة الإرجاع: | سلسلة ، تمثل المحاذاة الأفقية للنص داخل العنصر |
إصدار CSS | CSS1 |
مزيد من الأمثلة
مثال
إعادة محاذاة النص لعنصر:
alert(document.getElementById("demo").style.textAlign);
الصفحات ذات الصلة
دروس CSS: نص CSS
مرجع CSS: خاصية محاذاة النص
❮ نمط الكائن