CSS <generic-family> Data Type
The <generic-family> data type is a general font category, such as serif, sans-serif, monospace or system-ui, used as the last fallback in font-family.
Description
The <generic-family> CSS data type represents a keyword that names a general category of font, such as serif, sans-serif or monospace, rather than a specific font file. It is used in the font-family property and the font shorthand. When the browser sees a generic family, it picks a suitable installed font from that category, which means text is always readable even if none of the named fonts are available.
Because the browser and operating system decide which actual font is used, a generic family is normally placed at the end of a font-family list as the final fallback. For example, font-family: "Open Sans", Arial, sans-serif; tries Open Sans, then Arial, and if neither exists, uses the system's default sans-serif font. Generic family names are keywords, so they must not be put in quotes. Writing "serif" would make the browser look for a font literally named "serif".
The classic generic families are serif, sans-serif, monospace, cursive and fantasy. Newer families give access to the fonts of the user's own interface, such as system-ui and the ui-serif, ui-sans-serif, ui-monospace and ui-rounded keywords, as well as specialised families like math for mathematical notation, emoji for emoji characters and fangsong for a style of Chinese typeface. Support for the newer keywords varies; for example, the ui-* families are mainly supported in Safari, while system-ui works in all modern browsers.
Examples:
body {
font-family: "Open Sans", Arial, sans-serif;
}
code, pre {
font-family: ui-monospace, Menlo, Consolas, monospace;
}
.app-ui {
font-family: system-ui, sans-serif;
}
blockquote {
font-family: Georgia, "Times New Roman", serif;
}
Ending every font stack with a <generic-family> keyword is a simple habit that keeps your typography predictable on every device.
Interactive Demo
The quick brown fox jumps over 123
Syntax
<generic-family> = serif | sans-serif | monospace | cursive | fantasy | system-ui | ui-serif | ui-sans-serif | ui-monospace | ui-rounded | math | emoji | fangsong
Values
- serifFonts with small finishing strokes (serifs) at the ends of characters, such as Times New Roman or Georgia.
- sans-serifFonts without serifs, with plain stroke endings, such as Arial or Helvetica.
- monospaceFonts in which every character has the same width, such as Courier New or Consolas. Commonly used for code.
- cursiveFonts that resemble handwriting, with joined or partially joined strokes.
- fantasyDecorative fonts with playful or ornamental shapes.
- system-uiThe default user interface font of the operating system.
- ui-serifThe default serif font of the user interface.
- ui-sans-serifThe default sans-serif font of the user interface.
- ui-monospaceThe default monospace font of the user interface.
- ui-roundedThe default user interface font with rounded features.
- mathFonts designed for mathematical expressions, with support for superscripts, subscripts and special symbols.
- emojiFonts designed for displaying emoji characters.
- fangsongA style of Chinese characters between serif-style Song and cursive-style Kai forms, often used in government documents.
Example
Browser Support
The following information will show you the current browser support for the CSS generic-family data type. Hover over a browser icon to see the version that first introduced support for this CSS data type.
Desktop





Tablets & Mobile





