Css 谷歌字体字体不';t载荷

Css 谷歌字体字体不';t载荷,css,google-font-api,Css,Google Font Api,我试图将PT SAN添加到新闻稿中,但由于某些原因,它无法加载。我复制了几乎所有的代码,但它无法工作。我将非常感谢任何能帮助我的人 以下是CSS代码: h1, h2, h3 { font-family: 'PT Sans', sans-serif; } 以及HTML代码: <link href="http://fonts.googleapis.com/css?family=PT+Sans" rel="stylesheet" type="text/css"> 几点提示: 1

我试图将PT SAN添加到新闻稿中,但由于某些原因,它无法加载。我复制了几乎所有的代码,但它无法工作。我将非常感谢任何能帮助我的人

以下是CSS代码:

h1, h2, h3 {
    font-family: 'PT Sans', sans-serif;
}
以及HTML代码:

<link href="http://fonts.googleapis.com/css?family=PT+Sans" rel="stylesheet" type="text/css">
几点提示:
1.在执行任何其他操作之前,请先使用
开头的HTML代码。示例:

/*后面的代码*/

二,。如果这不起作用,请将其放在CSS文件中:
@导入url(http://fonts.googleapis.com/css?family=PT+Sans)

问问自己:

1. Are you developing online or offline (if online check number 2)

2. Make sure your browser does not have a shield icon because this 
   means the browser is blocking the font and you need to click
   the allow button.

3. Check for spelling errors or anything suspicious.

4. Finally @import is the safest way I think. 
尝试使用不带“http”的URL:


我也有同样的问题,如果使用CSS标记:

“font:3em bold;”---这将覆盖google api调用并加载下一个默认字体


解决方案:使用字体样式和字体大小检查css文件是否在供应商样式表之后加载。例如,bootstrap.css应该在css文件之前。

我今天遇到了这个问题。如果您使用httpsurl进行测试,则需要更改链接
href=”http://fonts.googleapis.com/css?family=PT+无“rel=”样式表“
href=”https://fonts.googleapis.com/css?family=PT+Sans“rel=”stylesheet“
。 否则,就会出现冲突问题


我希望这会让人产生希望。

你确定没有其他风格取代它吗?应该可以。你用的是什么浏览器?它支持嵌入式字体吗?您是否先加载
ptsans
样式,然后再尝试使用该字体?我们是否可以看到CSS和HTML的其余部分,以防其他样式覆盖它,如Torr3nt所说。我正在使用Google Chrome。指向我的CSS的链接位于Google字体CSS之后。根据你的编辑,你的CSS不应该覆盖它。你应该试着使用答案中的一种解决方案。遗憾的是,这两种方法都不起作用。尽管如此,我还是非常感谢你的帮助。这让我非常生气。@BartFriederichs省略协议将导致链接使用与当前页面URL相同的协议。当在https URL和http URL上使用时,链接将解析为。@ChrisParton,请注意,您的浏览器可能不会在https站点上加载场外http资源。
1. Are you developing online or offline (if online check number 2)

2. Make sure your browser does not have a shield icon because this 
   means the browser is blocking the font and you need to click
   the allow button.

3. Check for spelling errors or anything suspicious.

4. Finally @import is the safest way I think. 
<link href="//fonts.googleapis.com/css?family=PT+Sans" rel="stylesheet" type="text/css">