How to use css @font-face attribute

silencement
Release: 2019-05-29 11:50:10
Original
3718 people have browsed it

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 */
}
Copy after login

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;
}
Copy after login
Copy after login

Syntax

@font-face
{
font-properties
}
Copy after login
Copy after login

The following examples are fonts used in divs:

div
{
font-family: myFirstFont;
}
Copy after login
Copy after login

Syntax

@font-face
{
font-properties
}
Copy after login
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!