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 Family | Example Implementation Font |
---|---|
serif | Times |
sans-serif | Helvetica |
cursive | Zapf-Chancery |
fantasy | Western |
monospace | Courier |
<!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>
Home
HTML CSS Book
CSS
HTML CSS Book
CSS
Font:
- Font-related properties
- Selecting a Font with font-family
- Setting the Font Size
- Setting the Font Style and Weight
- Using Web Fonts
Related: