Google Material Design的图标字体使用教程

使用教程

1. 打开Material icons下载页

2. 选择要下载的图标 (目前不能多选>_<)

3.选择要下载的格式即可

图标字体使用教程

【方法一】

STEP 1: 引入字体文件和样式文件,下面这个是直接引用google的字体托管文件,如果国内使用建议不要用托管的,会访问慢,把字体下载到自己的服务器上,详细看【方法二】

<link href=”https://fonts.googleapis.com/icon?family=Material+Icons” rel=”stylesheet”>

STEP 2: HTML代码,在HTML标签上加入class=”material-icons”以及写上图标名称即可,如下:

<i class=”material-icons”>face</i>

【方法二】

如果你不想使用Google托管的CSS文件和图标字体,可以下载到本地。

STEP 1: 下载字体文件到本地

下载地址:https://github.com/google/material-design-icons/tree/master/iconfont

STEP 2 : 为你的CSS引入字体

@font-face {

font-family: 'Material Icons';

font-style: normal;

font-weight: 400;

src: url(https://example.com/MaterialIcons-Regular.eot); /* For IE6-8 */

src: local('Material Icons'),

local('MaterialIcons-Regular'),

url(https://example.com/MaterialIcons-Regular.woff2) format('woff2'),

url(https://example.com/MaterialIcons-Regular.woff) format('woff'),

url(https://example.com/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;

width: 1em;

height: 1em;

line-height: 1;

text-transform: none;

 

/* 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';

}

STEP 3: HTML代码

<i class="material-icons">face</i>

更新详细的使用教程:http://google.github.io/material-design-icons/

网站名称:Material icons

网站地址:https://www.google.com/design/icons/

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值