Font Family and Web-Safe Fonts
Set font families and understand which fonts are safe to use across all browsers.
font-family Property
The font-family property sets the typeface for an element. You provide a font stack: a comma-separated list of font names from most preferred to least, ending with a generic family.
body {
font-family: "Roboto", Arial, Helvetica, sans-serif;
}Generic Font Families
CSS defines five generic families as fallbacks:
serif— fonts with decorative strokes (Times, Georgia)sans-serif— clean fonts without strokes (Arial, Helvetica)monospace— fixed-width fonts (Courier, Consolas)cursive— handwriting-style fontsfantasy— decorative display fonts
All lessons in this course
- Font Family and Web-Safe Fonts
- Font Size Weight and Style
- Text Alignment Decoration and Spacing
- Google Fonts and @font-face