CSS Attributes Index Font Attributes
Specifies a font to embed into the HTML document.
HTML |
@font-face { font-family: font-family; src: url ( strUrl ) } |
Script |
N/A |
font-family |
Any of the range of values available to the fontFamily property. |
strUrl |
URL path to a font file. |
The rule has no default value.
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 on the font embedding feature and pointers to a tool for creating .eot files, see Font Embedding.
The following example shows how to embed a font in an HTML document by referencing its source from another site.
<style>
@font-face {
font-family: comic; src: url( "http://fonts.com/font_file.eot" );
}
</style>
. . .
<p style="font-family: comic; font-size: 18pt">
This line uses font-face rule defined in the above style element section using
comic sans ms bold in 18pt.
</p>
font, font-family, font-size, font-style, font-variant, font-weight