How to add custom font in my theme?

2019-08-31 02:30发布

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

2条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-31 02:59

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.

查看更多
爷、活的狠高调
3楼-- · 2019-08-31 03:04

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/

查看更多
登录 后发表回答