نمط الخط حجم الخاصية
مثال
اضبط حجم خط العنصر على "x-large":
document.getElementById("demo").style.fontSize = "x-large";
التعريف والاستخدام
تقوم الخاصية fontSize بتعيين أو إرجاع حجم خط النص.
دعم المتصفح
Property | |||||
---|---|---|---|---|---|
fontSize | Yes | Yes | Yes | Yes | Yes |
بناء الجملة
قم بإرجاع خاصية fontSize:
object.style.fontSize
قم بتعيين خاصية حجم الخط:
object.style.fontSize = "value|initial|inherit"
قيم الملكية
Value | Description |
---|---|
xx-small x-small small medium large x-large xx-large |
Sets the size of the font to different fixed sizes, from xx-small to xx-large |
smaller | Decreases the font-size by one relative unit |
larger | Increases the font-size by one relative unit |
length | Defines the font-size in length units |
% | Sets the font-size to a % of the parent element's font size |
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.fontSize = listValue;
مثال
إعادة حجم خط العنصر:
alert(document.getElementById("demo").style.fontSize);
الصفحات ذات الصلة
برنامج CSS التعليمي: CSS Font
مرجع CSS: خاصية حجم الخط
مرجع HTML DOM: خاصية الخط
❮ نمط الكائن