Style fontSize attribute
- Kutumia mabaki wa chini fontFamily
- Pya kati fontStyle
- Kutumia mabaki wa juu Mfumo wa Style ya HTML DOM
Definition and usage
fontSize
Set or return the font size of the text.
See also:
CSS Tutorial:CSS mifano ya heria
CSS Reference Manual:font-size attribute
HTML DOM Reference Manual:Font attribute
Instance
Example 1
Set the font size of the <p> element to "xx-large":
document.getElementById("myP").style.fontSize = "xx-large";
Example 2
Demonstration of possible values:
var listValue = selectTag.options[selectTag.selectedIndex].text; document.getElementById("myP").style.fontSize = listValue;
Example 3
Return the font size of the <p> element:
alert(document.getElementById("myP").style.fontSize);
Syntax
Return fontSize property:
object.style.fontSize
Set fontSize property:
object.style.fontSize = "value|initial|inherit"
Attribute value
Value | Description |
---|---|
|
Set the font size to a different fixed size, from xx-small to xx-large. |
smaller | Decrease the font size by a relative unit. |
larger | Increase the font size by a relative unit. |
length | Define the font size using a length unit. |
% | Set the font size to a percentage of the parent element's font size. |
initial | Set this property to its default value. See also initial. |
inherit | Inherit this property from its parent element. See also inherit. |
Technical details
Default value: | medium |
---|---|
Return value: | String that represents the font size of the element's text. |
CSS Version: | CSS1 |
Matumizi ya kawaida wa kibao
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Mwamadhamini | Mwamadhamini | Mwamadhamini | Mwamadhamini | Mwamadhamini |
- Kutumia mabaki wa chini fontFamily
- Pya kati fontStyle
- Kutumia mabaki wa juu Mfumo wa Style ya HTML DOM