How to add custom font in my theme?

蓝咒 提交于 2019-12-12 03:37:04

问题


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.

how to include it in css file in apropriate way? thank you


回答1:


You need to use @font-face with your font in either .ttf or .eot

Below is an example

@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;
}

For more details, look here http://bavotasan.com/2010/embedding-fonts-web-site-css-font-face/




回答2:


Monotype Corsiva is a copyrighted font. Check out http://www.fonts.com for conditions and instructions for use. They have a policy that allows a limited number of page views (25,000) for free. The instructions and procedures might be a bit confusing, but in the end you will have a script element generated by them to add to your pages, and then you will just use the font under the name they give you (it seems to be Corsiva W01).

Alternative, try and find a suitably similar free font from Google Web Fonts, for example.



来源:https://stackoverflow.com/questions/14518783/how-to-add-custom-font-in-my-theme

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!