نمط الخط الوزن الخاصية
مثال
اضبط وزن الخط لعنصر على "900":
document.getElementById("demo").style.fontWeight = "900";
التعريف والاستخدام
تحدد الخاصية fontWeight أو تعيد كيفية عرض الأحرف السميكة أو الرفيعة في النص.
دعم المتصفح
Property | |||||
---|---|---|---|---|---|
fontWeight | Yes | Yes | Yes | Yes | Yes |
بناء الجملة
قم بإرجاع خاصية fontWeight:
object.style.fontWeight
قم بتعيين خاصية fontWeight:
object.style.fontWeight = "normal|lighter|bold|bolder|value|initial|inherit"
قيم الملكية
Value | Description |
---|---|
normal | Font is normal. This is default |
lighter | Font is lighter |
bold | Font is bold |
bolder | Font is bolder |
100 200 300 400 500 600 700 800 900 |
Defines from light to bold characters. 400 is the same as normal, and 700 is the same as bold |
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.fontWeight = listValue;
مثال
إرجاع وزن الخط لعنصر:
alert(document.getElementById("demo").style.fontWeight);
الصفحات ذات الصلة
برنامج CSS التعليمي: CSS Font
مرجع CSS: خاصية وزن الخط
مرجع HTML DOM: خاصية الخط
❮ نمط الكائن