--- title: font-family slug: Web/CSS/@font-face/font-family translation_of: Web/CSS/@font-face/font-family ---
{{CSSRef}}
font-family属性允许我们为页面上的字体指定一个由{{cssxref("@font-face")}} 规则定义的字体族

The font-family CSS descriptor allows authors to specify the font family for the font specified in an {{cssxref("@font-face")}} rule.

{{cssinfo}}

语法

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

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

取值

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

Formal syntax

{{csssyntax}}

示例

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

规范

Specification Status Comment
{{SpecName('CSS3 Fonts', '#font-family-desc', 'font-family')}} {{Spec2('CSS3 Fonts')}} Initial definition

浏览器兼容性

{{CompatibilityTable}}

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatChrome("4")}} 12.0 {{CompatGeckoDesktop("1.9.1")}} {{CompatIE("6.0")}} {{CompatOpera("9.0")}} {{CompatSafari("3.1")}}
Feature Android Firefox Mobile (Gecko) IE Mobile Opera Mini Opera Mobile Safari Mobile
Basic support {{CompatAndroid("2.2")}} {{CompatGeckoMobile("1.9.1")}} {{CompatIE("10.0")}} {{CompatNo}} {{CompatOpera("12.0")}} {{CompatSafari("3.1")}}