The HTML DOM Style’s font property is used to change the element’s font properties. It can be used to change the font style, weight, size, and family.
- To set the font style :
node.style.font = "font-properties font-size font-family;"
- To get the current font style:
Property value: It is a string which has values like font properties, font size, and font family.
The properties are required in the following order :
- Font style
- Font variant
- Font weight
- Font size
- Font height
- Font family
text‘ ID element’s style.font property to ‘
gfg‘. We call this function from the buttons, and supply property values appropriately.
Supported Browsers: The browsers supported by DOM style.font property are listed below:
- Google Chrome
- Internet Explorer/Edge