--- title: font-family slug: Web/CSS/@font-face/font-family translation_of: Web/CSS/@font-face/font-family ---
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>
@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")}} |