CSS Font Family Property

The font family of a text is set with the font-family property.

Start with the font you want, and end with a generic family, to let the browser pick a similar font in the generic family, if no other fonts are available.


font-family: font|initial|inherit;
Generic font name Type of font Example
serif Fonts with serifs Time
sans-serif Fonts without serifs Arial
monospace Fixed-width fonts Curier
cursive Fonts that emulate handwritting Comic Sans
fantasy Decorative fonts for title and so on Impact

Note: If the name of a font family is more than one word, it must be in quotation marks, like: "Times New Roman".

More than one font family is specified in a comma-separated list:


Example of font-Family

 <!DOCTYPE html>
        <style type="text/css">
        font-family:courier new;
        <p class="p1">Ashwani</p>
        <p class="p2">Sachin</p>
        <p class="p3">Welcome to CSS Tutorial</p>



Welcome to CSS Tutorial

Share this article on