如何更改 C# MVC 项目中的字体系列?

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

我有一个更改了字体系列的 C# MVC 项目。在本地主机上,它可以工作,但是当它在服务器上时,它不工作。

本地主机:

并且在服务器上:

在我的 _Layout.cshtml(共享布局)上,我有以下字体样式参考:

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

在我的 site.css 文件中,我将:

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

有人知道为什么会这样,我该如何纠正?

我可以想象差异可能与服务器防火墙有关,请检查下面 link 的第 7 节并确保端口已打开。

If your network proxy or firewall blocks access to any of the required domains, font sync will not work. Your computer needs to be able to reach these endpoints and download files from them.

Here is a list of the required domains; port 443 also needs to be open.

https://data.typekit.net:443
https://state.typekit.net:443
https://polka.typekit.com:443
https://api.typekit.com:443

Use Typekit's network test page to check these connections from your computer in the web browser.

In-browser Testing

typekit troubleshooting

您对字体系列 <link rel="stylesheet" href="https://use.typekit.net/idk3wns.css"> 的请求被拒绝。

它是一个很棒、可靠且开放的字体资源 Google Fonts。在那里您可以找到许多字体并轻松获取链接。

具体到你的情况,你可以使用这个:

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

并像这样使用:

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