• linux
    
  • minus
    
  • music-circle
    
  • music-note
    
  • navigation
    
  • newspaper
    
  • note-text
    
  • notification-clear-all
    
  • open-in-app
    
  • open-in-new
    
  • package-variant
    
  • panda
    
  • paper-cut-vertical
    
  • paw
    
  • plus
    
  • pound
    
  • printer
    
  • printer-alert
    
  • puzzle
    
  • radar
    
  • radioactive
    
  • recycle
    
  • refresh
    
  • reply
    
  • reply-all
    
  • routes
    
  • rss
    
  • rss-box
    
  • send
    
  • settings
    
  • share-variant
    
  • square-inc-cash
    
  • table-edit
    
  • television
    
  • television-guide
    
  • tag
    
  • tag-multiple
    
  • teamviewer
    
  • telegram
    
  • thumb-up-outline
    
  • ticket-account
    
  • thumb-down
    
  • thumb-down-outline
    
  • thumb-up
    
  • tooltip-edit
    
  • unfold-less
    
  • unfold-more
    
  • upload
    
  • vector-combine
    
  • view-dashboard
    
  • video
    
  • view-grid
    
  • view-headline
    
  • view-list
    
  • view-module
    
  • vimeo
    
  • whatsapp
    
  • windows
    
  • wordpress
    
  • wrench
    
  • xbox-controller
    
  • window-close
    
  • xml
    
  • cast
    
  • cat
    
  • chart-bar
    
  • chart-line
    
  • chevron-double-down
    
  • chevron-double-left
    
  • chevron-double-right
    
  • chevron-down
    
  • chevron-left
    
  • chevron-right
    
  • chevron-up
    
  • city
    
  • clipboard-account
    
  • code-braces
    
  • code-tags
    
  • cow
    
  • desktop-mac
    
  • diamond
    
  • download
    
  • duck
    
  • earth
    
  • emoticon-devil
    
  • emoticon-poop
    
  • engine
    
  • folder-account
    
  • format-list-numbers
    
  • forum
    
  • ghost
    
  • github-box
    
  • github-circle
    
  • google-chrome
    
  • headphones
    
  • heart
    
  • home
    
  • image-filter-drama
    
  • image-filter-none
    
  • image-filter-vintage
    
  • image-multiple
    
  • import
    
  • information
    
  • information-outline
    
  • internet-explorer
    
  • jeepney
    
  • key-variant
    
  • leaf
    
  • led-on
    
  • laptop
    
  • laptop-chromebook
    
  • laptop-mac
    
  • laptop-windows
    
  • launch
    
  • layers
    
  • login
    
  • library-plus
    
  • lock
    
  • lock-open
    
  • lock-open-outline
    
  • lock-outline
    
  • logout
    
  • magnify
    
  • magnify-minus
    
  • magnify-plus
    
  • menu-down
    
  • menu-left
    
  • menu-right
    
  • menu-up
    
  • message-processing
    
  • message-reply
    
  • message-reply-text
    
  • message-text
    
  • microsoft
    
  • monitor
    
  • monitor-multiple
    
  • movie
    
  • music-box
    
  • music-box-outline
    
  • kongjian
    
  • meilishuo
    
  • pengyouquan0
    
  • pengyouquanyin0
    
  • pinterest0
    
  • qq0
    
  • renren0
    
  • sina
    
  • taobao
    
  • twitter
    
  • wangwang
    
  • weibo
    
  • weixin0
    
  • xin
    
  • zhifubao0
    
  • zhihu
    
  • account
    
  • account-circle
    
  • account-search
    
  • archive
    
  • bullhorn
    
  • cached
    
  • cake-layered
    
  • calendar-plus
    
  • calendar-text
    
  • camera
    
  • baidu0
    
  • douban
    
  • huaban
    
  • iconfont-shoucang
    
  • kaixinwang
    

Unicode 引用


Unicode 是字体在网页端最原始的应用方式,特点是:

  • 兼容性最好,支持 IE6+,及所有现代浏览器。
  • 支持按字体的方式去动态调整图标大小,颜色等等。
  • 但是因为是字体,所以不支持多色。只能使用平台里单色的图标,就算项目里有多色图标也会自动去色。

注意:新版 iconfont 支持多色图标,这些多色图标在 Unicode 模式下将不能使用,如果有需求建议使用symbol 的引用方式

Unicode 使用步骤如下:

第一步:拷贝项目下面生成的 @font-face

@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 的样式

.iconfont {
  font-family: "iconfont" !important;
  font-size: 16px;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

第三步:挑选相应图标并获取字体编码,应用于页面

<span class="iconfont">&#x33;</span>

"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。

  • linux
    .icon-linux1
  • minus
    .icon-minus
  • music-circle
    .icon-musiccircle
  • music-note
    .icon-musicnote
  • navigation
    .icon-navigation
  • newspaper
    .icon-newspaper
  • note-text
    .icon-notetext
  • notification-clear-all
    .icon-notificationclearall
  • open-in-app
    .icon-openinapp
  • open-in-new
    .icon-openinnew
  • package-variant
    .icon-packagevariant
  • panda
    .icon-panda
  • paper-cut-vertical
    .icon-papercutvertical
  • paw
    .icon-paw
  • plus
    .icon-plus
  • pound
    .icon-pound
  • printer
    .icon-printer
  • printer-alert
    .icon-printeralert
  • puzzle
    .icon-puzzle
  • radar
    .icon-radar
  • radioactive
    .icon-radioactive
  • recycle
    .icon-recycle
  • refresh
    .icon-refresh
  • reply
    .icon-reply
  • reply-all
    .icon-replyall
  • routes
    .icon-routes
  • rss
    .icon-rss
  • rss-box
    .icon-rssbox
  • send
    .icon-send
  • settings
    .icon-settings
  • share-variant
    .icon-sharevariant
  • square-inc-cash
    .icon-squareinccash
  • table-edit
    .icon-tableedit
  • television
    .icon-television
  • television-guide
    .icon-televisionguide
  • tag
    .icon-tag
  • tag-multiple
    .icon-tagmultiple
  • teamviewer
    .icon-teamviewer
  • telegram
    .icon-telegram
  • thumb-up-outline
    .icon-thumbupoutline
  • ticket-account
    .icon-ticketaccount
  • thumb-down
    .icon-thumbdown
  • thumb-down-outline
    .icon-thumbdownoutline
  • thumb-up
    .icon-thumbup
  • tooltip-edit
    .icon-tooltipedit
  • unfold-less
    .icon-unfoldless
  • unfold-more
    .icon-unfoldmore
  • upload
    .icon-upload
  • vector-combine
    .icon-vectorcombine
  • view-dashboard
    .icon-viewdashboard
  • video
    .icon-video
  • view-grid
    .icon-viewgrid
  • view-headline
    .icon-viewheadline
  • view-list
    .icon-viewlist
  • view-module
    .icon-viewmodule
  • vimeo
    .icon-vimeo
  • whatsapp
    .icon-whatsapp
  • windows
    .icon-windows
  • wordpress
    .icon-wordpress
  • wrench
    .icon-wrench
  • xbox-controller
    .icon-xboxcontroller
  • window-close
    .icon-windowclose
  • xml
    .icon-xml
  • cast
    .icon-cast
  • cat
    .icon-cat
  • chart-bar
    .icon-chartbar
  • chart-line
    .icon-chartline
  • chevron-double-down
    .icon-chevrondoubledown
  • chevron-double-left
    .icon-chevrondoubleleft
  • chevron-double-right
    .icon-chevrondoubleright
  • chevron-down
    .icon-chevrondown
  • chevron-left
    .icon-chevronleft
  • chevron-right
    .icon-chevronright
  • chevron-up
    .icon-chevronup
  • city
    .icon-city
  • clipboard-account
    .icon-clipboardaccount
  • code-braces
    .icon-codebraces
  • code-tags
    .icon-codetags
  • cow
    .icon-cow
  • desktop-mac
    .icon-desktopmac
  • diamond
    .icon-diamond
  • download
    .icon-download
  • duck
    .icon-duck
  • earth
    .icon-earth
  • emoticon-devil
    .icon-emoticondevil
  • emoticon-poop
    .icon-emoticonpoop
  • engine
    .icon-engine
  • folder-account
    .icon-folderaccount
  • format-list-numbers
    .icon-formatlistnumbers
  • forum
    .icon-forum
  • ghost
    .icon-ghost
  • github-box
    .icon-githubbox
  • github-circle
    .icon-githubcircle
  • google-chrome
    .icon-googlechrome
  • headphones
    .icon-headphones
  • heart
    .icon-heart
  • home
    .icon-home
  • image-filter-drama
    .icon-imagefilterdrama
  • image-filter-none
    .icon-imagefilternone
  • image-filter-vintage
    .icon-imagefiltervintage
  • image-multiple
    .icon-imagemultiple
  • import
    .icon-import
  • information
    .icon-information
  • information-outline
    .icon-informationoutline
  • internet-explorer
    .icon-internetexplorer
  • jeepney
    .icon-jeepney
  • key-variant
    .icon-keyvariant
  • leaf
    .icon-leaf
  • led-on
    .icon-ledon
  • laptop
    .icon-laptop
  • laptop-chromebook
    .icon-laptopchromebook
  • laptop-mac
    .icon-laptopmac
  • laptop-windows
    .icon-laptopwindows
  • launch
    .icon-launch
  • layers
    .icon-layers
  • login
    .icon-login
  • library-plus
    .icon-libraryplus
  • lock
    .icon-lock
  • lock-open
    .icon-lockopen
  • lock-open-outline
    .icon-lockopenoutline
  • lock-outline
    .icon-lockoutline
  • logout
    .icon-logout
  • magnify
    .icon-magnify
  • magnify-minus
    .icon-magnifyminus
  • magnify-plus
    .icon-magnifyplus
  • menu-down
    .icon-menudown
  • menu-left
    .icon-menuleft
  • menu-right
    .icon-menuright
  • menu-up
    .icon-menuup
  • message-processing
    .icon-messageprocessing
  • message-reply
    .icon-messagereply
  • message-reply-text
    .icon-messagereplytext
  • message-text
    .icon-messagetext
  • microsoft
    .icon-microsoft
  • monitor
    .icon-monitor
  • monitor-multiple
    .icon-monitormultiple
  • movie
    .icon-movie
  • music-box
    .icon-musicbox
  • music-box-outline
    .icon-musicboxoutline
  • kongjian
    .icon-kongjian
  • meilishuo
    .icon-meilishuo
  • pengyouquan0
    .icon-pengyouquan0
  • pengyouquanyin0
    .icon-pengyouquanyin0
  • pinterest0
    .icon-pinterest0
  • qq0
    .icon-qq0
  • renren0
    .icon-renren0
  • sina
    .icon-sina
  • taobao
    .icon-taobao
  • twitter
    .icon-twitter
  • wangwang
    .icon-wangwang
  • weibo
    .icon-weibo
  • weixin0
    .icon-weixin0
  • xin
    .icon-xin
  • zhifubao0
    .icon-zhifubao0
  • zhihu
    .icon-zhihu
  • account
    .icon-account
  • account-circle
    .icon-accountcircle
  • account-search
    .icon-accountsearch
  • archive
    .icon-archive
  • bullhorn
    .icon-bullhorn
  • cached
    .icon-cached
  • cake-layered
    .icon-cakelayered
  • calendar-plus
    .icon-calendarplus
  • calendar-text
    .icon-calendartext
  • camera
    .icon-camera
  • baidu0
    .icon-baidu0
  • douban
    .icon-douban
  • huaban
    .icon-huaban
  • iconfont-shoucang
    .icon-iconfontshoucang
  • kaixinwang
    .icon-kaixinwang

font-class 引用


font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。

与 Unicode 使用方式相比,具有如下特点:

  • 兼容性良好,支持 IE8+,及所有现代浏览器。
  • 相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。
  • 因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。
  • 不过因为本质上还是使用的字体,所以多色图标还是不支持的。

使用步骤如下:

第一步:引入项目下面生成的 fontclass 代码:

<link rel="stylesheet" href="./iconfont.css">

第二步:挑选相应图标并获取类名,应用于页面:

<span class="iconfont icon-xxx"></span>

" iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。

  • linux
    #icon-linux1
  • minus
    #icon-minus
  • music-circle
    #icon-musiccircle
  • music-note
    #icon-musicnote
  • navigation
    #icon-navigation
  • newspaper
    #icon-newspaper
  • note-text
    #icon-notetext
  • notification-clear-all
    #icon-notificationclearall
  • open-in-app
    #icon-openinapp
  • open-in-new
    #icon-openinnew
  • package-variant
    #icon-packagevariant
  • panda
    #icon-panda
  • paper-cut-vertical
    #icon-papercutvertical
  • paw
    #icon-paw
  • plus
    #icon-plus
  • pound
    #icon-pound
  • printer
    #icon-printer
  • printer-alert
    #icon-printeralert
  • puzzle
    #icon-puzzle
  • radar
    #icon-radar
  • radioactive
    #icon-radioactive
  • recycle
    #icon-recycle
  • refresh
    #icon-refresh
  • reply
    #icon-reply
  • reply-all
    #icon-replyall
  • routes
    #icon-routes
  • rss
    #icon-rss
  • rss-box
    #icon-rssbox
  • send
    #icon-send
  • settings
    #icon-settings
  • share-variant
    #icon-sharevariant
  • square-inc-cash
    #icon-squareinccash
  • table-edit
    #icon-tableedit
  • television
    #icon-television
  • television-guide
    #icon-televisionguide
  • tag
    #icon-tag
  • tag-multiple
    #icon-tagmultiple
  • teamviewer
    #icon-teamviewer
  • telegram
    #icon-telegram
  • thumb-up-outline
    #icon-thumbupoutline
  • ticket-account
    #icon-ticketaccount
  • thumb-down
    #icon-thumbdown
  • thumb-down-outline
    #icon-thumbdownoutline
  • thumb-up
    #icon-thumbup
  • tooltip-edit
    #icon-tooltipedit
  • unfold-less
    #icon-unfoldless
  • unfold-more
    #icon-unfoldmore
  • upload
    #icon-upload
  • vector-combine
    #icon-vectorcombine
  • view-dashboard
    #icon-viewdashboard
  • video
    #icon-video
  • view-grid
    #icon-viewgrid
  • view-headline
    #icon-viewheadline
  • view-list
    #icon-viewlist
  • view-module
    #icon-viewmodule
  • vimeo
    #icon-vimeo
  • whatsapp
    #icon-whatsapp
  • windows
    #icon-windows
  • wordpress
    #icon-wordpress
  • wrench
    #icon-wrench
  • xbox-controller
    #icon-xboxcontroller
  • window-close
    #icon-windowclose
  • xml
    #icon-xml
  • cast
    #icon-cast
  • cat
    #icon-cat
  • chart-bar
    #icon-chartbar
  • chart-line
    #icon-chartline
  • chevron-double-down
    #icon-chevrondoubledown
  • chevron-double-left
    #icon-chevrondoubleleft
  • chevron-double-right
    #icon-chevrondoubleright
  • chevron-down
    #icon-chevrondown
  • chevron-left
    #icon-chevronleft
  • chevron-right
    #icon-chevronright
  • chevron-up
    #icon-chevronup
  • city
    #icon-city
  • clipboard-account
    #icon-clipboardaccount
  • code-braces
    #icon-codebraces
  • code-tags
    #icon-codetags
  • cow
    #icon-cow
  • desktop-mac
    #icon-desktopmac
  • diamond
    #icon-diamond
  • download
    #icon-download
  • duck
    #icon-duck
  • earth
    #icon-earth
  • emoticon-devil
    #icon-emoticondevil
  • emoticon-poop
    #icon-emoticonpoop
  • engine
    #icon-engine
  • folder-account
    #icon-folderaccount
  • format-list-numbers
    #icon-formatlistnumbers
  • forum
    #icon-forum
  • ghost
    #icon-ghost
  • github-box
    #icon-githubbox
  • github-circle
    #icon-githubcircle
  • google-chrome
    #icon-googlechrome
  • headphones
    #icon-headphones
  • heart
    #icon-heart
  • home
    #icon-home
  • image-filter-drama
    #icon-imagefilterdrama
  • image-filter-none
    #icon-imagefilternone
  • image-filter-vintage
    #icon-imagefiltervintage
  • image-multiple
    #icon-imagemultiple
  • import
    #icon-import
  • information
    #icon-information
  • information-outline
    #icon-informationoutline
  • internet-explorer
    #icon-internetexplorer
  • jeepney
    #icon-jeepney
  • key-variant
    #icon-keyvariant
  • leaf
    #icon-leaf
  • led-on
    #icon-ledon
  • laptop
    #icon-laptop
  • laptop-chromebook
    #icon-laptopchromebook
  • laptop-mac
    #icon-laptopmac
  • laptop-windows
    #icon-laptopwindows
  • launch
    #icon-launch
  • layers
    #icon-layers
  • login
    #icon-login
  • library-plus
    #icon-libraryplus
  • lock
    #icon-lock
  • lock-open
    #icon-lockopen
  • lock-open-outline
    #icon-lockopenoutline
  • lock-outline
    #icon-lockoutline
  • logout
    #icon-logout
  • magnify
    #icon-magnify
  • magnify-minus
    #icon-magnifyminus
  • magnify-plus
    #icon-magnifyplus
  • menu-down
    #icon-menudown
  • menu-left
    #icon-menuleft
  • menu-right
    #icon-menuright
  • menu-up
    #icon-menuup
  • message-processing
    #icon-messageprocessing
  • message-reply
    #icon-messagereply
  • message-reply-text
    #icon-messagereplytext
  • message-text
    #icon-messagetext
  • microsoft
    #icon-microsoft
  • monitor
    #icon-monitor
  • monitor-multiple
    #icon-monitormultiple
  • movie
    #icon-movie
  • music-box
    #icon-musicbox
  • music-box-outline
    #icon-musicboxoutline
  • kongjian
    #icon-kongjian
  • meilishuo
    #icon-meilishuo
  • pengyouquan0
    #icon-pengyouquan0
  • pengyouquanyin0
    #icon-pengyouquanyin0
  • pinterest0
    #icon-pinterest0
  • qq0
    #icon-qq0
  • renren0
    #icon-renren0
  • sina
    #icon-sina
  • taobao
    #icon-taobao
  • twitter
    #icon-twitter
  • wangwang
    #icon-wangwang
  • weibo
    #icon-weibo
  • weixin0
    #icon-weixin0
  • xin
    #icon-xin
  • zhifubao0
    #icon-zhifubao0
  • zhihu
    #icon-zhihu
  • account
    #icon-account
  • account-circle
    #icon-accountcircle
  • account-search
    #icon-accountsearch
  • archive
    #icon-archive
  • bullhorn
    #icon-bullhorn
  • cached
    #icon-cached
  • cake-layered
    #icon-cakelayered
  • calendar-plus
    #icon-calendarplus
  • calendar-text
    #icon-calendartext
  • camera
    #icon-camera
  • baidu0
    #icon-baidu0
  • douban
    #icon-douban
  • huaban
    #icon-huaban
  • iconfont-shoucang
    #icon-iconfontshoucang
  • kaixinwang
    #icon-kaixinwang

Symbol 引用


这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇文章 这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:

  • 支持多色图标了,不再受单色限制。
  • 通过一些技巧,支持像字体那样,通过 font-size, color 来调整样式。
  • 兼容性较差,支持 IE9+,及现代浏览器。
  • 浏览器渲染 SVG 的性能一般,还不如 png。

使用步骤如下:

第一步:引入项目下面生成的 symbol 代码:

<script src="./iconfont.js"></script>

第二步:加入通用 CSS 代码(引入一次就行):

<style>
.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
  fill: currentColor;
  overflow: hidden;
}
</style>

第三步:挑选相应图标并获取类名,应用于页面:

<svg class="icon" aria-hidden="true">
  <use xlink:href="#icon-xxx"></use>
</svg>