Font-family property

Last updated: 2026-09-13

font-family Font-family property

The font-family CSS property specifies a prioritized list of font family names and/or generic family names for an element. The browser uses the first available font in the list, walking down the chain when a font is missing.

Category
Initial Valuedepends on user agent
InheritedYes
Applies Toall
Animation Typediscrete
CSS VersionCSS1
StatusStandard

📝 Syntax

font-family: [ <family-name> | <generic-family> ]#;

⚙️ Values

ValueTypeDescription
<family-name>TypeA specific font family name, e.g. 'Microsoft YaHei'
<generic-family>KeywordA generic font family: serif, sans-serif, or monospace

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
font-family v1 v12 v1 v1 v1
Supported in all major browsers
Tip: Font names containing spaces or special characters must be quoted, for example "Times New Roman".
Important: Always end the list with a generic family (serif, sans-serif, monospace) as a final fallback.

❓ FAQ

QWhich fonts should I use for a Chinese-language website in CSS?
AA common cross-platform fallback chain is "PingFang SC", "Microsoft YaHei", sans-serif; for English you can add Helvetica or Arial first. Microsoft YaHei is picked up on Windows and PingFang SC on macOS, with the generic sans-serif at the end guaranteeing the text still renders on any system.
QHow do I load a custom web font using the @font-face rule in CSS?
ADeclare the font first with @font-face, for example: @font-face { font-family: 'MyFont'; src: url('myfont.woff2') format('woff2'); }, then include 'MyFont' in your font-family list. Prefer the woff2 format for smaller file sizes, and keep a generic family at the end of the list as a fallback.
QDoes the order of multiple font-family values in the list matter?
AYes. The browser checks the list from left to right and uses the first font that is installed; fonts later in the list are only used if earlier ones are unavailable. Order the list by preference, and end with a generic family (serif, sans-serif, monospace) as the ultimate fallback.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏