@font-face Rule

DHTML, HTML, & CSS

 
Click to return to the DHTML, HTML & CSS home page    
@charset Rule     @import Rule     DHTML Properties    

@font-face Rule


Sets a font to embed in the HTML document.

Syntax

HTML@font-face { sFace }
ScriptingN/A

Possible Values

sFace String that specifies one of the following values:
font-family:fontFamilyNameAny of the range of values available to the fontFamily property.
src:url(sURL)Location of the font file, where sURL is an absolute or relative URL.

The rule has no default value.

Expressions can be used in place of the preceding value(s), as of Microsoft® Internet Explorer 5. For more information, see dynamic propertiesInternet Link.

Remarks

This feature allows you to use specific fonts that might not be available on your local system. The URL should point to an embedded OpenType file (.eot or .ote format). The file contains compressed font data that is converted to a TrueType font. For more information about the font embedding feature and pointers to a tool for creating .eot files, see font embeddingInternet Link.

Example

This example embeds a font in an HTML document by referencing its source from another site.

Sample Code

<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 above style element.  The rule embeds 
an OpenType file for the Comic Sans font.
</P>
</BODY>
</HTML>

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.