How to use CSS font-family
The CSS font-family property defines what font an element will use when it contains text:
p {
font-family: "Arial Black", "Arial Bold", Gadget, sans-serif;
}
This property can also hold several values separated by commas as a fallback system. If one font is not available or not supported, then the following font specified by the property can be used.
- Easy to use with a learn-by-doing approach
- Offers quality content
- Gamified in-browser coding experience
- The price matches the quality
- Suitable for learners ranging from beginner to advanced
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid Certificates of completion
- A wide range of learning programs
- University-level courses
- Easy to navigate
- Verified certificates
- Free learning track available
- University-level courses
- Suitable for enterprises
- Verified certificates of completion
Defining font families
The syntax for CSS font-family is as follows:
font-family:Â value;
There are two ways to specify a CSS font family: you can either define an exact embedded or downloaded font, or name one of five generic font families:
cursive
fantasy
monospace
serif
sans-serif
When listing multiple CSS font families, you should begin by specifying the font you'd prefer the most and finish by specifying a generic family as a fallback. Then, if no specified fonts are available, the browser will select a similar accessible font from the generic CSS font family.
Note: if the font name contains a space, it has to be surrounded by quotes.