CSS @font-face

The CSS @font-face is used when we need to use custom fonts for our web application. For this, put the font file on the server, and include the font file URL and the name of the font to be use. For example:

@font-face {
   font-family: FontName;
   src: url(FontFileURL);
}

Note - The SVG font format only supports by the Safari 3.2 and newer versions.

Note - The EOT font format only supports by the Internet Explorer or Edge 6.2 and newer versions.

Note - Use lowercase letters as font URL to avoid unexpected results produced by the Internet Explorer browser.

CSS @font-face Syntax

The syntax of @font-face in CSS, is:

@font-face {fontProperty: value; fontProperty: value; ...}

Here are the list of font properties that we can include in @font-face

Note - The default value of font-stretch, font-style, and font-weight is normal.

Note - From all the above properties, the font-family and src are required.

CSS Online Test


« Previous Tutorial Next Tutorial »