How to change the font-family on a C# MVC project?

Hatsumi picture Hatsumi · Jun 25, 2018 · Viewed 12.3k times · Source

I have a C# MVC project that I changed the font-family. On localhost, it works, but when it's on the server, it's not working.

Localhost: Localhost image

And on the server: Server image

On my _Layout.cshtml (a shared layout) I have the following reference of the font style:

<link rel="stylesheet" href="https://use.typekit.net/idk3wns.css">

And on my site.css file, I put that:

*{
    font-family: indie-flower, sans-serif;
    font-style: normal;
    font-weight: 400;
}

Someone knows why it's happening this and how can I correct that?

Answer

Felipe Augusto picture Felipe Augusto · Jun 25, 2018

Your request to the font-family <link rel="stylesheet" href="https://use.typekit.net/idk3wns.css"> is beeing rejected.

A great, reliable and open resource of fonts it Google Fonts. There you can find many fonts and get the links easily.

Specifically in your case, you can use this one:

<link href="https://fonts.googleapis.com/css?family=Indie+Flower" rel="stylesheet">

And use like this:

*{
    font-family: 'Indie Flower', sans-serif;
    font-style: normal;
    font-weight: 400;
}