I volontari di MDN non hanno ancora tradotto questo articolo in Italiano. Unisciti a noi e traducilo tu stesso.
Puoi anche consultare l’articolo in English (US).

The @font-face CSS at-rule allows authors to specify fonts (online url(), and locally local()), to display text on their web pages. By allowing authors to provide their own fonts, @font-face eliminates the need to depend on the limited number of fonts users have installed on their computers. By allowing authors to access users fonts, @font-face eliminates the dependencies of having internet access, as well as downloading the font's resources locally. These seemingly contrasting options empower developers to take advantage of the users settings in order to provide a seamless typographical experience. The @font-face at-rule may be used not only at the top level of a CSS, but also inside any CSS conditional-group at-rule.

@font-face {
  font-family: "Open Sans";
  src: url("/fonts/OpenSans-Regular-webfont.woff2") format("woff2"),
       url("/fonts/OpenSans-Regular-webfont.woff") format("woff");



Determines how a font face is displayed based on whether and when it is downloaded and ready to use.
Specifies a name that will be used as the font face value for font properties.
A font-stretch value.
A font-style value.
A font-weight value.
A font-variant value.
Allows control over advanced typographic features in OpenType fonts.
Allows low-level control over OpenType or TrueType font variations, by specifying the four letter axis names of the features to vary, along with their variation values.
Specifies the resource containing the font data. This can be a URL to a remote font file location or the name of a font on the user's computer.
The range of Unicode code points to be used from the font.

Formal syntax

@font-face {
  [ font-family: <family-name>; ] ||
  [ src: [ <url> [ format(<string>#) ]? | <font-face-name> ]#; ] ||
  [ unicode-range: <urange>#; ] ||
  [ font-variant: <font-variant>; ] ||
  [ font-feature-settings: normal | <feature-tag-value>#; ] ||
  [ font-variation-settings: normal | [ <string> <number>] # ||
 [ font-stretch: <font-stretch>; ] ||
  [ font-weight: <weight>; ] ||
  [ font-style: <style>; ]

<family-name> = <string> | <custom-ident>+
<feature-tag-value> = <string> [ <integer> | on | off ]?


This example simply specifies a downloadable font to use, applying it to the entire body of the document:

View the live example

  <title>Web Font Sample</title>
  <style type="text/css" media="screen, print">
    @font-face {
      font-family: "Bitstream Vera Serif Bold";
      src: url("https://mdn.mozillademos.org/files/2468/VeraSeBd.ttf");
    body { font-family: "Bitstream Vera Serif Bold", serif }
  This is Bitstream Vera Serif Bold.

In this example, the user's local copy of "Helvetica Neue Bold" is used; if the user does not have that font installed (two different names are tried), then the downloadable font named "MgOpenModernaBold.ttf" is used instead:

@font-face {
  font-family: MyHelvetica;
  src: local("Helvetica Neue Bold"),
  font-weight: bold;


  • Web fonts are subject to the same domain restriction (font files must be on the same domain as the page using them), unless HTTP access controls are used to relax this restriction.
  • Because there are no defined MIME types for TrueType, OpenType, and Web Open File Format (WOFF) fonts, the MIME type of the file specified is not considered.
  • @font-face cannot be declared within a CSS selector. For example, the following will not work:
    .className { 
      @font-face { 
        font-family: MyHelvetica; 
        src: local("Helvetica Neue Bold"),
        font-weight: bold; 


Specification Status Comment
WOFF File Format 2.0
The definition of 'WOFF2 font format' in that specification.
Proposed Recommendation Font format specification with new compression algorithm
WOFF File Format 1.0
The definition of 'WOFF font format' in that specification.
Recommendation Font format specification
CSS Fonts Module Level 3
The definition of '@font-face' in that specification.
Candidate Recommendation Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support4123.54103.1
WOFF6 Yes3.5911.15.1
WOFF 23614



SVG fonts No No No No No Yes
font-display60 No58 No47 Yes
font-feature-settings No No


15 -moz- 4

No No No
font-style4 ?3.54103.1
unicode-range Yes Yes369 Yes Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes12410 Yes Yes
WOFF4.4 Yes Yes4115 Yes
WOFF 2363614



SVG fonts No No No No No Yes No
font-display6060 No5847 Yes No
font-family2.2 ?124123.1 Yes
font-feature-settings No No No


15 -moz- 4

No No No
font-style Yes ? ?410 Yes Yes
font-weight Yes Yes12410 Yes Yes
src2.2 ?124123.1 Yes
unicode-range ? ? Yes36 ? Yes Yes

1. From version 35: this feature is behind the gfx.downloadable_fonts.woff2.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.

2. Supported only on macOS 10.12 (Sierra) and later.

3. The ISO/IEC CD 14496-22 3rd edition suggests using the ssty feature to provide glyph variants more suitable for use in scripts (for example primes used as superscripts). Starting with Firefox 29, this is done automatically by the MathML rendering engine. The ISO/IEC CD 14496-22 3rd edition also suggests applying the dtls feature to letters when placing mathematical accents to get dotless forms (for example dotless i, j with a hat). Starting with Firefox 35, this is done automatically by the MathML rendering engine. You can override the default values determined by the MathML rendering engine with CSS.

4. From Firefox 4 to Firefox 14 (inclusive), Firefox supported an older, slightly different syntax. See OpenType Font Feature support in Firefox 4.

See also