Skip to content

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

Open
@haizhilin2013

Description

@haizhilin2013
Collaborator

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

Activity

encountermm

encountermm commented on Jul 3, 2019

@encountermm

@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

FurryWolfX commented on Nov 29, 2019

@FurryWolfX

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

smile-2008

smile-2008 commented on Nov 20, 2020

@smile-2008

@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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @smile-2008@haizhilin2013@FurryWolfX@encountermm

        Issue actions

          [css] 第53天 怎么使用自定义字体?有什么注意事项? · Issue #208 · haizlin/fe-interview