Selecting a Font with font-family

The font-family property specifies the fonts that will be used, in order of preference.

CSS defines some generic fonts that are available everywhere. A summary of the generic font families:

Generic Font FamilyExample Implementation Font
serifTimes
sans-serifHelvetica
cursiveZapf-Chancery
fantasyWestern
monospaceCourier
 
<!DOCTYPE HTML> 
<html> 
    <head> 
        <title>Example</title> 
        <style> 
            p { 
                padding: 5px; 
                border: medium double black; 
                background-color: lightgrey; 
                margin: 2px; 
                float: left; 
                font-family: "HelveticaNeue Condensed", monospace; 
            } 
        </style> 
    </head> 
    <body> 
        <p> 
            HyperText Markup Language (HTML) is the main markup language for 
            displaying web pages and other information that can be displayed 
            in a web browser(From From Wikipedia, the free encyclopedia).
        </p> 
    </body> 
</html>
  
Click to view the demo
Home 
  HTML CSS Book 
    CSS  

Font:
  1. Font-related properties
  2. Selecting a Font with font-family
  3. Setting the Font Size
  4. Setting the Font Style and Weight
  5. Using Web Fonts
Related: