zoukankan      html  css  js  c++  java
  • 字蛛webfont 安装及使用方法

    先安装nodejs和git,比如放在D:/nodejs/  文件夹

    cmd 进入该文件夹,安装npm install express

    安装 npm install font-spider -g

    安装 npm install grunt-font-spider --save-dev

    安装 npm install gulp-font-spider --save-dev

    至此,安装完成。比如我们要压缩 F:/test/www/  目录下的字体,先把ttf字体放在 www/font/ 文件夹里,

    然后用cmd进入www文件夹,执行:font-spider index.html 或者font-spider *.html 即可。

    然后在css文件里参照此引用 :

    /*声明 WebFont*/
    @font-face {
      font-family: 'pinghei';
      src: url('../font/pinghei.ttf');
      src:
        url('../font/pinghei.eot') format('embedded-opentype'),
        url('../font/pinghei.woff') format('woff'),
        url('../font/pinghei.ttf') format('truetype'),
        url('../font/pinghei.svg') format('svg');
      font-weight: normal;
      font-style: normal;
    }
    
    /*使用选择器指定字体*/
    .home h1, .demo > .test {
        font-family: 'pinghei';
    }
    

      字体文件依然放在font文件夹里。这样就ok了。

    官网:http://font-spider.org/

  • 相关阅读:
    打开网页总结
    学期总结
    总结
    Sprint3
    Sprint2团队贡献分
    6.14
    典型用户与场景
    5种创建型模式
    JAVA 将接口的引用指向实现类的对象
    Java里的接口
  • 原文地址:https://www.cnblogs.com/happyty/p/4766583.html
Copyright © 2011-2022 走看看