Style fontFamily Property
Style fontFamily Property
The font-family property is used to set or return the font-family property of an element. It can hold several font names as a fallback system. If the browser does not support the first font, it tries the next font. It has two types:-
family-name :- The name of a font-family like courier, arial, etc.
generic-family :- The name of a generic-family like serif, sans-serif, fantasy, etc.
For best writing, a font family, start with a family-name and end it with a generic name and separate each of them with a comma.
Syntax:-
Its syntax is:- object.style.fontFamily OR object.style.fontFamily = "font1, font2, etc.|initial|inherit"
Return:-
Its return is:- string having font-family property of an element
Further Explanation:-
Value | Description |
---|---|
font1, font2, etc. | A comma-separated list of font-family names. |
initial | Sets this property to its default value. |
inherit | Inherits this property from its parent element. |