How specify the font of my text with CSS

You can specify the typeface that your text will adopt by using font-family property:

p {

font-family: serif;


CSS allows the specifications of some more generic font families, which are:

– cursive

– fantasy

– monospace

– sans-serif

– serif

– verdana

When you define a font that users don’t have on their computer, your text will display in their Web browser’s default font. You can simply use generic font names and let users’ system decide which font to apply.  If you want your document to appear in a sans-serif font such as Arial, you can simply use the following code:

p {

font-family: sans-serif;


You will have more control over the way your site Web site displays by using the following CSS declaration for <p> tag:

p {

font-family: Geneva, Helvetica, Verdana,  Arial, sans-serif;


In this case if Geneva is installed on the system, it will be used; if it’s not installed, the computer is directed to see if the user has Helvetica installed; failing that, the computer will look for Verdana, then Arial. If none of these fonts is available, the computer instructed to use the system’s default san-serif font.