@font-face

Sets a font to embed in the HTML document.

Syntax

@font-face { sFontDescription }

Possible values

sFontDescription

String that specifies the following values:

font-family: font-familyName

Any of the range of values available to the font-family property.

src: url(sURL)

Location of the font file, where sURL is an absolute or relative URL.

Remarks

This rule has no default value.

This feature allows you to use specific fonts that might not be available on your computer. The URL must point to an embedded OpenType file (.eot or .ote format). The file contains compressed font data that is converted to a TrueType font.

Example

The following example embeds a font in an HTML document by pointing to the font source, which is located at another site:

<html>
<head><style>
   @font-face {
      font-family:comic;
      src:url(http://valid_url/some_font_file.eot);
   }
</style>
</head>
<body>
<p style="font-family:comic;font-size:18pt">
This paragraph uses the font-face rule defined
in the preceding style element.  The rule embeds 
an OpenType file for the Comic Sans font.
</p>
</body>
</html>

Standards information

This rule is defined in Cascading Style Sheets (CSS), Level 2 (CSS2) Ee371244.xtlink_newWindow(en-us,Expression.40).png.

See also

Concepts

font-family

Send feedback about this topic to Microsoft. © 2011 Microsoft Corporation. All rights reserved.