Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css] 第53天 怎么使用自定义字体?有什么注意事项? #208

Open
haizhilin2013 opened this issue Jun 7, 2019 · 3 comments
Labels
css css

Comments

@haizhilin2013
Copy link
Collaborator

第53天 怎么使用自定义字体?有什么注意事项?

@haizhilin2013 haizhilin2013 added the css css label Jun 7, 2019
@encountermm
Copy link

encountermm commented Jul 3, 2019

@font-face {
font-family: '自定义字体名称';
src: url('字体文件名.eot'); /* IE9 Compat Modes /
src: url('字体文件名.eot?#iefix') format('embedded-opentype'), /
IE6-IE8 /
url('字体文件名.woff') format('woff'), /
Modern Browsers /
url('字体文件名.ttf') format('truetype'), /
Safari, Android, iOS /
url('字体文件名.svg#字体文件名') format('svg'); /
Legacy iOS */
font-style: normal;
font-weight: normal;
}


给相应的标签指定font-family,就可以使用你的自定义字体了

@FurryWolfX
Copy link

用法楼上已经说了,我补充一下注意事项:
这个方案对西文比较友好,因为西文字体体积较小,而中文基本都是10mb以上的,极度不友好。
故中文最好使用标准字体。或者根据用到的文字按需编写字库文件。

@MrZ2019
Copy link

MrZ2019 commented Nov 20, 2020

@font-face {
font-family: '自定义字体名称';
src: url('字体文件名.eot'); /* IE9 Compat Modes / src: url('字体文件名.eot?#iefix') format('embedded-opentype'), / IE6-IE8 / url('字体文件名.woff') format('woff'), / Modern Browsers / url('字体文件名.ttf') format('truetype'), / Safari, Android, iOS / url('字体文件名.svg#字体文件名') format('svg'); / Legacy iOS */
font-style: normal;
font-weight: normal;
}

给相应的标签指定font-family,就可以使用你的自定义字体了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
css css
Projects
None yet
Development

No branches or pull requests

4 participants