font-family

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since September 2016.

font-family 属性允许我们为页面上的字体指定一个由 @font-face 规则定义的字体族

The font-family CSS descriptor allows authors to specify the font family for the font specified in an @font-face rule.

Related at-rule@font-face
初始值n/a (required)
计算值as specified

语法

css
/* <string> values */
font-family: "font family";
font-family: "another font family";

/* <IDENT> value */
font-family: examplefont;

取值

<family-name>

指定字体族名称

Formal syntax

font-family = 
<family-name>

<family-name> =
<string> |
<custom-ident>+

示例

css
@font-face {
  font-family: examplefont;
  src: url("examplefont.ttf");
}

规范

Specification
CSS Fonts Module Level 4
# font-family-desc

浏览器兼容性

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
font-family

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support