CSS font-family is a list of font family names from which first value is used if present otherwise next value and so on. Here is sample usage:
body { font-family: Gill, Helvetica, sans-serif }
CSS property font-family
| CSS version: | CSS 2.1 |
| Value: | [family-name | generic-family] [, family-name | generic-family]* |
| Initial: | depends on user-agent |
| Applies to: | all elements |
| Inherited: | yes |
Example – font-family
In the following code, CSS property font-family can be changed to the following values
- Helvetica
- sans-serif
- serif
- cursive
- fantasy
- monospace
<style type="text/css">
div {
width: 100px; background-color: lightblue;
font-family: Helvetica;
}
</style>
<div>This is sample text to test font-family property</div>
Text outside divfont-family refresh