نمط الخط خاصية نمط
مثال
تعيين الخط لعنصر ما على "مائل":
document.getElementById("demo").style.fontStyle = "italic";
التعريف والاستخدام
تحدد الخاصية fontStyle أو ترجع ما إذا كان نمط الخط عاديًا أم مائلًا أم مائلًا.
دعم المتصفح
Property | |||||
---|---|---|---|---|---|
fontStyle | Yes | Yes | Yes | Yes | Yes |
بناء الجملة
قم بإرجاع خاصية fontStyle:
object.style.fontStyle
قم بتعيين خاصية fontStyle:
object.style.fontStyle = "normal|italic|oblique|initial|inherit"
قيم الملكية
Value | Description |
---|---|
normal | Font is normal. This is default |
italic | Font is in italic |
oblique | Font is in oblique |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
تفاصيل تقنية
القيمة الافتراضية: | عادي |
---|---|
قيمة الإرجاع: | سلسلة ، تمثل نمط خط النص في العنصر |
إصدار CSS | CSS1 |
مزيد من الأمثلة
مثال
عرض للقيم الممكنة:
var listValue = selectTag.options[selectTag.selectedIndex].text;
document.getElementById("demo").style.fontStyle = listValue;
مثال
إعادة نمط الخط لعنصر ما:
alert(document.getElementById("demo").style.fontStyle);
الصفحات ذات الصلة
برنامج CSS التعليمي: CSS Font
مرجع CSS: خاصية نمط الخط
مرجع HTML DOM: خاصية الخط
❮ نمط الكائن