Milad
Milad

Reputation: 63

Custom fonts doesn't work in a certain html/css project

I can't change the fonts to custom fonts in my project. But The following code does work in a separate test case, but I don't know why this doesn't work in my working project. I don't know what is causing the issue.

Upvotes: 1

Views: 171

Answers (1)

Brayden W
Brayden W

Reputation: 128

👋

First of all, is the path to your font really nazanin.ttf? Is it in the same folder as this current CSS file?

If it is in a separate folder called "fonts", then try something like this:

@font-face{
  font-family: nazanin;
  src: url(../fonts/nazanin.ttf);
}

Second of all, the .ttf file extension is for Safari, iOS, and Android. Are you using a different browser? If so, that's the problem. I would suggest going with the .woff extension because it is compatible with most modern browsers.

Upvotes: 1

Related Questions