How to change the font-family of a single div with . tff file?

Asked

Viewed 493 times

0

I’d like to change the font-family of a div in particular for a font that I can’t find the source, but I found a file font. How can I add this font? Does there exist a code for it?

In this link found the font what desire.

1 answer

1


After downloading the font, will vim some files with extension . ttf, . otf among others. Add these files to the project folder, usually I paste them into public/fonts.

To add and use the source in the code is used @font-face, this is known as import source:

@font-face {
     font-family: "NomeDaFonte;
     src: url("arquivo-fote.otf");
}

Tag font-family you put the name you will use. On the second tag src you place the location where the downloaded files are.

Now to add in a div specifies:

.minha-div{
     font-family: "NomeDaFonte";
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.