CSS Font - font-family
Description
Use font-family to change the typeface of the text within html elements. In addition use this property to specify generic fallback font families in case the specified font is not available on the users computer.
Note: if there are any spaces in the the font family name then use double quotes around the name.
font-family: name
font-family: name, "generic family name"
e.g.
font-family: verdana;
font-family: arial, sans-serif;
See also: font, font-size, font-variant, font-weight.
Examples for font-family
Example 1:
Simple example using times new roman.
Test text test text test text test text.
<style>
#test { font-size: "times new roman"; }
</style>
<div id="test">test text test text test text test text</div>
Values for font-family
| font-family |
family-name generic-family
|
Specifies the font name alternatively you can specify the generic name family name of the font/text. |
| font-size |
em e.g. 1.3em
% e.g. 150%
pt e.g. 14pt
xx-small x-small small medium large x-large xx-large larger smaller
|
Specifies the size of the font/text. |
| font-style |
normal|italic|oblique |
normal is the default. On most browsers oblique is the same as italic. |
| font-weight |
normal bold bolder lighter 100 200 300 400 500 600 700 800 900 |
normal is the default. 400 is the same as normal. 700 is the same as bold |