如何在我的主题中添加自定义字体? [英] How to add custom font in my theme?
问题描述
现在,我想使用Monotype Corsiva。我添加字体在我的主题,然后在css文件使用 font-family:Monotype Corsiva
,但有些人提示我:字体用于网站标题和标题不工作if它不是安装在用户系统上。您应该删除主题目录中的字体文件或以适当的方式将其包含在css文件中。
now, i want to use Monotype Corsiva. i add the font in my theme ,then in css file using font-family:Monotype Corsiva
,but some one tips me: font used for site title and headings is not working if it's not installed on users system. You should either remove font file from theme directory or include it in css file in apropriate way.
如何以适当的方式将其包含在css文件中?谢谢
how to include it in css file in apropriate way? thank you
推荐答案
您需要在.ttf或.eot
You need to use @font-face with your font in either .ttf or .eot
下面是一个例子
@font-face {
font-family: 'RieslingRegular';
src: url('fonts/riesling.eot');
src: local('Riesling Regular'), local('Riesling'), url('fonts/riesling.ttf') format('truetype');
}
h1 {
font-family: 'RieslingRegular', Arial, sans-serif;
}
有关详情,请参阅 http://bavotasan.com/2010/embedding-fonts-web-site-css-font-face/
这篇关于如何在我的主题中添加自定义字体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!