CSS generic() function
- Category
- CSS
- Type
- Chromium catches up
- Status
- Proposed (Chrome Proposed)
- Intent stage
- None
Summary
CSS is introducing a new functional syntax for newer generic font families: `generic()`. Instead of adding more bare keywords that might clash with real font names, script-specific generics are written like `generic(fangsong)`, `generic(kai)`, `generic(khmer-mul)`, and `generic(nastaliq)`.
Motivation
CSS has outgrown the original Latin-centric handful of generic font families, but adding more bare keywords to `font-family` is dangerous for web compatibility. The mechanism is very useful, but the original categories don't describe typography well across the world's writing systems. For example, Chinese commonly distinguishes Song, Hei, Kai, and Fangsong styles.
Standards & signals
- Specification: https://drafts.csswg.org/css-fonts-4/#generic-font-families
- Firefox: No signal
- Safari: No signal
- Web developers: No signals
Ecosystem
- Web Platform Tests: https://wpt.fyi/results/?q=css-generic-function
- Chrome Platform Showcase: https://chrome-platform-showcase.paulkinlan-ea.deno.net/features
- GenDN reference: https://gendn.paulkinlan-ea.deno.net/features
- chrome.dev demos search: https://www.google.com/search?q=site%3Achrome.dev+CSS%20generic()%20function
- MDN Web Docs: https://developer.mozilla.org/en-US/search?q=CSS%20generic()%20function
- Baseline status: https://webstatus.dev/?q=CSS%20generic()%20function