font-family part 1

The font-family Property



The font-family property specifies the font for an element. 
There are two types of font family names: 
font family: a specific font family (like Times New Roman or Arial)
generic family: a group of font families with a similar look (like Serif or Monospace)

Here is an example of different font styles:
The HTML:<p class="serif">
This is a paragraph shown in serif font.
</p>
<p class="sansserif">
This is a paragraph shown in sans-serif font.
</p>
<p class="monospace">
This is a paragraph shown in monospace font.
</p>
<p class="cursive">
This is a paragraph shown in cursive font.
</p>
<p class="fantasy">
This is a paragraph shown in fantasy font.
</p>

The CSS:
p.serif {
font-family: "Times New Roman", Times, serif;
}
p.sansserif {
font-family: Helvetica, Arial, sans-serif;
}
p.monospace {
font-family: "Courier New", Courier, monospace;
}
p.cursive {
font-family: Florence, cursive;
}
p.fantasy {
font-family: Blippo, fantasy;
}
Try It Yourself

Result:
Separate each value with a comma to indicate that they are alternatives. 
If the name of a font family is more than one word, it must be in quotation marks: "Times New Roman".

Comments

Popular posts from this blog

Styling the list part 3