font-family

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

语法

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

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

取值

<family-name>
指定字体族名称

Formal syntax

<family-name>

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

示例

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

规范

Specification Status Comment
CSS Fonts Module Level 3
font-family
Recommendation Initial definition

浏览器兼容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support 4 12.0 3.5 (1.9.1) 6.0 9.0 3.1
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mini Opera Mobile Safari Mobile
Basic support 2.2 1.0 (1.9.1) 10.0 未实现 12.0 3.1