How to host material icons offline?

后端 未结 19 2466
无人及你
无人及你 2020-12-02 06:55

My apologies if this is a very simple question, but how do you use google material icons without a



        
19条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-02 07:34

    After you have done npm install material-design-icons, add this in your main CSS file:

    @font-face {
      font-family: 'Material Icons';
      font-style: normal;
      font-weight: 400;
      src: url(~/material-design-icons/iconfont/MaterialIcons-Regular.eot); /* For IE6-8 */
      src: local('Material Icons'),
           local('MaterialIcons-Regular'),
           url(~material-design-icons/iconfont/MaterialIcons-Regular.woff2) format('woff2'),
           url(~material-design-icons/iconfont/MaterialIcons-Regular.woff) format('woff'),
           url(~material-design-icons/iconfont/MaterialIcons-Regular.ttf) format('truetype');
    }
    
    .material-icons {
      font-family: 'Material Icons';
      font-weight: normal;
      font-style: normal;
      font-size: 24px;  /* Preferred icon size */
      display: inline-block;
      line-height: 1;
      text-transform: none;
      letter-spacing: normal;
      word-wrap: normal;
      white-space: nowrap;
      direction: ltr;
    
      /* Support for all WebKit browsers. */
      -webkit-font-smoothing: antialiased;
      /* Support for Safari and Chrome. */
      text-rendering: optimizeLegibility;
    
      /* Support for Firefox. */
      -moz-osx-font-smoothing: grayscale;
    
      /* Support for IE. */
      font-feature-settings: 'liga';
    }
    

提交回复
热议问题