How to place a font using a class?

Asked

Viewed 76 times

1

i can put the font on the site all tals. (as I left) image below how I left.... (as I left the code) inserir a descrição da imagem aqui

and below this the css file

inserir a descrição da imagem aqui

outworking

inserir a descrição da imagem aqui

only that I want to leave a class instead of the "H2" EXAMPLE

inserir a descrição da imagem aqui

css

inserir a descrição da imagem aqui

HOW I DO TO GET THE SAME ?

I thank you from now on help from all !

  • 2

    Please do not put the codes as an image, it is impossible to copy to reproduce the problem. The site has source code support, just do the [tour] to learn more.

  • Take a look at this question: https://answall.com/questions/191805/como-e-qual-a-best-forma-de-usar-fontes-com-css/192591#192591 . Can help you.

1 answer

2

Friend just missed a point . in the name of your class...

Every class name must start with a . guy .rodape and then you put the styles. And in HTML your element will be with class="rodape"

Ex:

.rodape {
	font-family: 'Margarine', cursive;
	font-size: 3rem;
}
<link href="https://fonts.googleapis.com/css?family=Margarine" rel="stylesheet">

<div class="rodape">
  Odonto
</div>

I recommend you read this Mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/CSS/Seletores_CSS


Tip: If you are already indexing the source on head of your website by <link href="https://fonts.googleapis.com/css?family=Bangers|Open+Sans" rel="stylesheet"> then there’s no reason for you to use the @font-face in the CSS the way you did... Try to opt for one or the other approach, unless you want to make a fallback from source, which from what I’ve seen is not your intention.

The way you did the user is downloading the Font twice, once by the link on head and one directly from your server ../fonte/etc. Don’t do this is bad practice.

  • yes because I resorted in various ways was not succeeding, I only managed to leave in the folder.... am having enough difficulty putting the source directly from some link (google fonts preference) .... as I do ?

  • Your font-family is spelled wrong! If you will only use the link in head vc you should put in CSS like this: font-family: 'Bangers', cursive;

  • could call me on Whats app 11 952744168 I’m not getting :/ of course if I can tbm without problems I try to turn around here

  • @caiquesey if it’s working here have to work ai tb, just you take it easy and do the things from the beginning, just put the font link in the right head, and in CSS vc puts the font-family with the right name. Look for tutorials on how to use Google Font that will help you, but all you need is there in the answer.

Browser other questions tagged

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