1. 程式人生 > >阿裏圖標庫使用IconFont

阿裏圖標庫使用IconFont

box conf body amp onf ace off mil iconfont

1、註冊賬號登陸

2、創建項目

3、搜索想使用的圖標,添加入庫,或者上傳自己的圖標入庫技術分享圖片

4、在圖標庫中,將添加的圖標加入項目

技術分享圖片

5、將項目圖標下載至本地

技術分享圖片

6、下載文件為

技術分享圖片

包括三種格式,使用方法不同

  • Unicode
  • Font class
  • Symbol

7、將文件引入頁面開始使用,引入iconfot.css, 如果圖標是多色的,那麽就需要引入iconfont.js文件

代碼實現,css

    <link rel="stylesheet" href="font/iconfont.css">
    <style>
@font-face { font-family: ‘iconfont‘; src: url(‘iconfont.eot‘); src: url(‘iconfont.eot?#iefix‘) format(‘embedded-opentype‘), url(‘iconfont.woff2‘) format(‘woff2‘), url(‘iconfont.woff‘) format(‘woff‘), url(‘iconfont.ttf‘) format(‘truetype‘), url(‘iconfont.svg#iconfont‘) format(‘svg‘)
; } .iconfont { font-family: "iconfont" !important; font-size: 32px; font-style: normal; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } </style>

html

<body>
    <
span class="iconfont">&#xe657;</span> <span class="iconfont">&#xe661;</span> <span class="iconfont">&#xe646;</span> <span class="iconfont">&#xe658;</span> <span class="iconfont">&#xe66a;</span> <span class="iconfont">&#xe609;</span> <span class="iconfont">&#xe600;</span> <span class="iconfont">&#xe6e1;</span> </body>

效果圖

技術分享圖片

大功告成

阿裏圖標庫使用IconFont