首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

@font-face.font-family

CSS属性font-family允许您通过给定一个有先后顺序的,由字体名或者字体族名组成的列表来为选定的元素设置字体。 属性的值用逗号隔开。浏览器会选择列表中第一个该计算机上有安装的字体,或者是通过@font-face指定的可以直接下载的字体。

Related at-rule

@font-face

初始值

n/a (required)

使用媒体

all

计算值

as specified

正规顺序

the unique non-ambiguous order defined by the formal grammar

语法

代码语言:javascript
复制
/* <string> values */
font-family: "font family";
font-family: 'another font family';

/* <custom-ident> value */
font-family: examplefont;

取值

<family-name>一个字体族的名字。例如"Times" 和 "Helvetica" 都是字体族名。字体族名可以包含空格,但包含空格时应该用引号。

形式语法

代码语言:javascript
复制
<family-name>where 
<family-name> = <string> | <custom-ident>+

实例

代码语言:javascript
复制
@font-face {
  font-family: examplefont;
  src: url('examplefont.ttf');
}

规范

Specification

Status

Comment

CSS Fonts Module Level 3The definition of 'font-family' in that specification.

Candidate Recommendation

Initial definition

浏览器兼容性

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

No support

12.0

3.1

扫码关注腾讯云开发者

领取腾讯云代金券