@font-face 中的 src 描述符指定了包含字体数据的资源。@font-face 规则中需要指定这个属性。


与 CSS 中的其他 URL 一样,URL 可以是相对的,在这种情况下,它相对于包含 @ font-face 规则的样式表的位置进行解析。对于 SVG 字体,URL 指向文档中定义的包含 SVG 字体的元素。如果省略元素引用,则默认引用第一个定义字体。同样,字体容器只加载@font-face 规则给定的其中一种字体。片段标识符用于指示要加载的字体。如果容器格式缺少定义的片段标识符方案,将会使用一个简单的基于 1 的索引方案(e.g., "font-collection#1" for the first font, "font-collection#2" for the second font, etc.)

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


/* <url> values */
src: url(; /* Absolute URL */
src: url(path/to/font.woff);                         /* Relative URL */
src: url(path/to/font.woff) format("woff");          /* Explicit format */
src: url('path/to/font.woff');                       /* Quoted URL */
src: url(path/to/svgfont.svg#example);               /* Fragment identifying font */

/* <font-face-name> values */
src: local(font);      /* Unquoted name */
src: local(some font); /* Name containing space */
src: local("font");    /* Quoted name */

/* Multiple items */
src: local(font), url(path/to/font.svg) format("svg"),
     url(path/to/font.woff) format("woff"),
     url(path/to/font.otf) format("opentype");


<url> [ format( <string># ) ]?

Specifies an external reference consisting of a <url>, followed by an optional hint using the


function to describe the format of the font resource referenced by that URL. The format hint contains a comma-separated list of format strings that denote well-known font formats. If a user agent doesn't support the specified formats, it skips downloading the font resource. If no format hints are supplied, the font resource is always downloaded.


Specifies the name of a locally-installed font face using the


function, which uniquely identifies a single font face within a larger family. The name can optionally be enclosed in quotes.

Formal syntax

src = 
see prose


@font-face {
  font-family: examplefont;
  src: local(Example Font),
       url('examplefont.woff') format("woff"),
       url('examplefont.otf') format("opentype");


CSS Fonts Module Level 4
# src-desc

Browser compatibility

BCD tables only load in the browser