将Google Web字体用于自定义WordPress主题 [英] Using a Google Web Font for a custom WordPress theme

查看:84
本文介绍了将Google Web字体用于自定义WordPress主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了自定义WordPress主题(这是我第一次使用WordPress,因此我仍然学到很多东西),我需要使Blog的字体与网站其余部分的字体匹配,这是Google Web字体.

I have just installed a custom WordPress theme (this is my first time working with WordPress, so I'm still learning a lot) and I need to make the font of the blog match the font for the rest of the web site, which is a Google Web Font.

我去了WordPress仪表板中自定义主题的样式表编辑器,并通过@import添加了字体.所以目前看起来像这样:

I went to the custom theme's stylesheet editor in the WordPress Dashboard and added the font via @import. So it currently looks like this:

/* Make all custom CSS changes BELOW this line
-----------------------------------------------------------*/

@import url("http://fonts.googleapis.com/css?family=Questrial:700,400");

body { font-family: Questrial, sans-serif; }

但这并没有改变博客中的字体.我没有正确实现网络字体吗?有什么更好/其他的方法可以完成我要完成的工作?

But that didn't change the font in the blog. Am I not implementing the web font correctly? Is there some better/other way to do what I'm trying to accomplish?

感谢任何人的帮助!

推荐答案

好吧,看来您在正确实现字体.

Well, it looks like you are implementing the font correctly.

尝试使用诸如Firebug for Firefox或Google Chrome的内置开发人员工具之类的工具,以查看HTTP请求是否已从Google字体服务器恢复正常.

Try using a tool like Firebug for Firefox or Google Chrome's built in developer tools to see if the HTTP Request is coming back OK from the Google Fonts server.

如果正确加载CSS文件,则可能是CSS继承引起的.由于级联样式表的级联"部分,重要性列表上可能存在更高的规则.您只需要搜寻并找到它.同样,您也可以使用Firebug或Chrome开发者工具.

If it's properly loading the CSS file, your problem may lie within CSS inheritance. Because of the 'Cascading' part of the Cascading Style Sheets, there may be a rule that is higher on the list of importance. You'll just have to hunt through and find it. Again you can use Firebug or Chrome developer tools for this as well.

最简单的解决方案可能是简单地添加font-family: Questrial, sans-serif !important;

The most simple solution may be simply adding an font-family: Questrial, sans-serif !important;

这篇关于将Google Web字体用于自定义WordPress主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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