一、字体定义文件

这里我们只要知道有这些格式的字体文件即可,不用背下来。

  • ttf:True Type Font,Windows里面一般都是这种格式的,【控制面板】->【字体】可以查看系统自带字体。
  • otf:Open Type Font
  • eot:Embeded Open Type, IE仅支持该字体。
  • woff:Web Open Font Format。
  • svg:基于SVG渲染的字体。

    二、@font-face

    2.1 定义字体

    1. @font-face {
    2. font-family: <name>;
    3. src: <source> [<format>][,<source> [<format>]]*;
    4. [font-weight: <weight>];
    5. [font-style: <style>];
    6. }
  • :设置自定义字体的名称,使用字体时引用该名称即可。

  • :定义字体定义文件的路径。
  • :帮助浏览器识别字体格式。