Style Object
The fontFamily property sets or returns a list of font-family names and/or generic-family names for text in an element.
The browser will use the first value it recognizes.
There are two types of font-family values:
Tip: Always specify a generic-family name as the last alternative!
Note: If a font-family name contains whitespace, it must be quoted.
Tip: Look at Web safe fonts for commonly used font combinations.
Set the fontFamily property:
Return the fontFamily property:
| Value | Description |
|---|---|
| font1, font2, etc. | A comma-separated list of font-family names and/or generic-family names |
| inherit | The value of the fontFamily property is inherited from parent element |
![]()
The fontFamily property is supported in all major browsers.
Note: The value "inherit" is not supported in IE7 and earlier. IE8 requires a !DOCTYPE. IE9 supports "inherit".
Change the font of a text:
Style Object
Your message has been sent to W3Schools.