Google字体未显示在Firefox中 [英] Google font not showing in firefox

查看:108
本文介绍了Google字体未显示在Firefox中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的网站,我使用了几种Google字体:

for my website I'm using couple of google fonts:

@import url(https://fonts.googleapis.com/css?family=Montserrat:400,700);
@import url(https://fonts.googleapis.com/css?family=Raleway:300,400,300italic,400italic&subset=latin,latin-ext);

@font-face {
    font-family: 'Montserrat', sans-serif;
    font-family: 'Raleway', sans-serif;
}

在Chrome和Safari中运行良好,但是在Firefox(我尝试过47和47.0.1)中,"Montserrat"字体没有显示.

The work well in Chrome and Safari, but in Firefox (I tried 47 and 47.0.1) the font "Montserrat" is not displaied.

这很好奇,因为我在控制台中没有出现网络错误或其他错误,并且只有一个无法正常工作,另一个却正常工作.

It's very curious because I get no network error or no other error in the console and only one is not working, the other one is working fine.

您知道什么解决方案吗? 谢谢!

Do you know any solutions? Thanks!

推荐答案

正如大家指出的那样,我发布的代码可在Firefox上运行.问题是字体家族被另一个CSS覆盖(仍然不知道为什么仅在Firefox中会发生这种情况...).我刚刚创建了此类:

As you guys were pointing out the code I posted works on Firefox. The problem was that the font-family was override by another css (still don't know why this was happening only in Firefox...). I just created this class:

.font-montserrat {
    font-family: 'Montserrat', sans-serif;
}

并刚刚添加:

.font-montserrat {
    font-family: 'Montserrat', sans-serif !important;
}

现在该字体已在每个浏览器中正确呈现!

Now the font is properly rendered in every browser!

这篇关于Google字体未显示在Firefox中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆