Home  >  Article  >  Web Front-end  >  How to use css @font-face attribute

How to use css @font-face attribute

silencement
silencementOriginal
2019-05-29 11:50:103650browse

How to use css @font-face attribute

css @font-face property

Specify a font named "myFirstFont" and specify a URL where to find it

@font-face
{
font-family: myFirstFont;
src: url('Sansation_Light.ttf'),
     url('Sansation_Light.eot'); /* IE9 */
}

css @font-face attribute Attribute definition and usage instructions

@font-face rules, one of the "web-safe" fonts that web designers no longer have to use one.

The name of the font, font-face rule

font-family: myFirstFont

The font file is included somewhere on your server, refer to CSS

src: url('Sansation_Light.ttf')

If the font file is in a different location, please use the complete URL

src: url('http://www.w3cschool .css/css3/Sansation_Light.ttf')

Now you are ready to use the font, here is an example of how to use it with all div elements

div
{
font-family: myFirstFont;
}

Syntax

@font-face
{
font-properties
}

The following examples are fonts used in divs:

div
{
font-family: myFirstFont;
}

Syntax

@font-face
{
font-properties
}

The above is the detailed content of How to use css @font-face attribute. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn