• add
    
  • minus
    
  • close_circle
    
  • selected
    
  • warn
    
  • coin
    
  • down_s
    
  • up_s
    
  • AA pay
    
  • compass
    
  • pie chart_1
    
  • pie chart_2
    
  • personal
    
  • network
    
  • query
    
  • no
    
  • details
    
  • anger
    
  • smail
    
  • compass
    
  • left
    
  • right
    
  • right
    
  • left
    
  • under
    
  • up
    
  • delete
    
  • Selected
    
  • add
    
  • more
    
  • scan
    
  • pay
    
  • travel
    
  • card
    
  • collect
    
  • bus code
    
  • pay_collect
    
  • account book
    
  • bank card
    
  • bar chart
    
  • bill
    
  • bulletin
    
  • bus
    
  • calculator
    
  • calendar
    
  • chat_add
    
  • chat_right
    
  • chat_wrong
    
  • chat
    
  • classification
    
  • volume
    
  • close_volume
    
  • voice
    
  • voice_close
    
  • volume
    
  • volume_close
    
  • collection
    
  • content
    
  • coupon
    
  • downland
    
  • upload
    
  • edit
    
  • express
    
  • eye
    
  • no_eye
    
  • face recognition
    
  • fill in
    
  • folder
    
  • me
    
  • friends_add
    
  • Friend settings
    
  • address book
    
  • pepole
    
  • friend_delete
    
  • friend_delete_2
    
  • address
    
  • friend_settings
    
  • gift
    
  • good
    
  • home
    
  • huititle
    
  • information_add
    
  • fill in
    
  • key
    
  • lock
    
  • koubei
    
  • link
    
  • live
    
  • location
    
  • logo
    
  • loop
    
  • mail
    
  • open mail
    
  • mark
    
  • more
    
  • movie
    
  • payment
    
  • picture
    
  • play
    
  • live
    
  • red packet
    
  • refresh
    
  • loop
    
  • search
    
  • send
    
  • fill in
    
  • information_add
    
  • shop
    
  • slice
    
  • target
    
  • text deletion
    
  • text
    
  • trash
    
  • type
    
  • upload
    
  • wallet
    
  • zoom out
    
  • zoom
    
  • system-QRcode
    
  • system-phonebook
    

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"。

  • add
    .icon-add
  • minus
    .icon-minus
  • close_circle
    .icon-close_circle
  • selected
    .icon-selected
  • warn
    .icon-warn
  • coin
    .icon-coin
  • down_s
    .icon-down_s
  • up_s
    .icon-up_s
  • AA pay
    .icon-AApay
  • compass
    .icon-compass
  • pie chart_1
    .icon-piechart_1
  • pie chart_2
    .icon-piechart_2
  • personal
    .icon-personal
  • network
    .icon-network
  • query
    .icon-query
  • no
    .icon-no
  • details
    .icon-details
  • anger
    .icon-anger
  • smail
    .icon-smail
  • compass
    .icon-compass1
  • left
    .icon-left
  • right
    .icon-right
  • right
    .icon-right1
  • left
    .icon-left1
  • under
    .icon-under
  • up
    .icon-up
  • delete
    .icon-delete
  • Selected
    .icon-Selected
  • add
    .icon-add1
  • more
    .icon-more
  • scan
    .icon-scan
  • pay
    .icon-pay
  • travel
    .icon-travel
  • card
    .icon-card
  • collect
    .icon-collect
  • bus code
    .icon-buscode
  • pay_collect
    .icon-pay_collect
  • account book
    .icon-accountbook
  • bank card
    .icon-bankcard
  • bar chart
    .icon-barchart
  • bill
    .icon-bill
  • bulletin
    .icon-bulletin
  • bus
    .icon-bus
  • calculator
    .icon-calculator
  • calendar
    .icon-calendar
  • chat_add
    .icon-chat_add
  • chat_right
    .icon-chat_right
  • chat_wrong
    .icon-chat_wrong
  • chat
    .icon-chat
  • classification
    .icon-classification
  • volume
    .icon-volume
  • close_volume
    .icon-close_volume
  • voice
    .icon-voice
  • voice_close
    .icon-voice_close
  • volume
    .icon-volume1
  • volume_close
    .icon-volume_close
  • collection
    .icon-collection
  • content
    .icon-content
  • coupon
    .icon-coupon
  • downland
    .icon-downland
  • upload
    .icon-upload
  • edit
    .icon-edit
  • express
    .icon-express
  • eye
    .icon-eye
  • no_eye
    .icon-no_eye
  • face recognition
    .icon-facerecognition
  • fill in
    .icon-fillin
  • folder
    .icon-folder
  • me
    .icon-me
  • friends_add
    .icon-friends_add
  • Friend settings
    .icon-Friendsettings
  • address book
    .icon-addressbook
  • pepole
    .icon-pepole
  • friend_delete
    .icon-friend_delete
  • friend_delete_2
    .icon-friend_delete_2
  • address
    .icon-address
  • friend_settings
    .icon-friend_settings
  • gift
    .icon-gift
  • good
    .icon-good
  • home
    .icon-home
  • huititle
    .icon-huititle
  • information_add
    .icon-information_add
  • fill in
    .icon-fillin1
  • key
    .icon-key
  • lock
    .icon-lock
  • koubei
    .icon-koubei
  • link
    .icon-link
  • live
    .icon-live
  • location
    .icon-location
  • logo
    .icon-logo
  • loop
    .icon-loop
  • mail
    .icon-mail
  • open mail
    .icon-openmail
  • mark
    .icon-mark
  • more
    .icon-more1
  • movie
    .icon-movie
  • payment
    .icon-payment
  • picture
    .icon-picture
  • play
    .icon-play
  • live
    .icon-live1
  • red packet
    .icon-redpacket
  • refresh
    .icon-refresh
  • loop
    .icon-loop1
  • search
    .icon-search
  • send
    .icon-send
  • fill in
    .icon-fillin2
  • information_add
    .icon-information_add1
  • shop
    .icon-shop
  • slice
    .icon-slice
  • target
    .icon-target
  • text deletion
    .icon-textdeletion
  • text
    .icon-text
  • trash
    .icon-trash
  • type
    .icon-type
  • upload
    .icon-upload1
  • wallet
    .icon-wallet
  • zoom out
    .icon-zoomout
  • zoom
    .icon-zoom
  • system-QRcode
    .icon-system-QRcode
  • system-phonebook
    .icon-system-phonebook

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"。

  • add
    #icon-add
  • minus
    #icon-minus
  • close_circle
    #icon-close_circle
  • selected
    #icon-selected
  • warn
    #icon-warn
  • coin
    #icon-coin
  • down_s
    #icon-down_s
  • up_s
    #icon-up_s
  • AA pay
    #icon-AApay
  • compass
    #icon-compass
  • pie chart_1
    #icon-piechart_1
  • pie chart_2
    #icon-piechart_2
  • personal
    #icon-personal
  • network
    #icon-network
  • query
    #icon-query
  • no
    #icon-no
  • details
    #icon-details
  • anger
    #icon-anger
  • smail
    #icon-smail
  • compass
    #icon-compass1
  • left
    #icon-left
  • right
    #icon-right
  • right
    #icon-right1
  • left
    #icon-left1
  • under
    #icon-under
  • up
    #icon-up
  • delete
    #icon-delete
  • Selected
    #icon-Selected
  • add
    #icon-add1
  • more
    #icon-more
  • scan
    #icon-scan
  • pay
    #icon-pay
  • travel
    #icon-travel
  • card
    #icon-card
  • collect
    #icon-collect
  • bus code
    #icon-buscode
  • pay_collect
    #icon-pay_collect
  • account book
    #icon-accountbook
  • bank card
    #icon-bankcard
  • bar chart
    #icon-barchart
  • bill
    #icon-bill
  • bulletin
    #icon-bulletin
  • bus
    #icon-bus
  • calculator
    #icon-calculator
  • calendar
    #icon-calendar
  • chat_add
    #icon-chat_add
  • chat_right
    #icon-chat_right
  • chat_wrong
    #icon-chat_wrong
  • chat
    #icon-chat
  • classification
    #icon-classification
  • volume
    #icon-volume
  • close_volume
    #icon-close_volume
  • voice
    #icon-voice
  • voice_close
    #icon-voice_close
  • volume
    #icon-volume1
  • volume_close
    #icon-volume_close
  • collection
    #icon-collection
  • content
    #icon-content
  • coupon
    #icon-coupon
  • downland
    #icon-downland
  • upload
    #icon-upload
  • edit
    #icon-edit
  • express
    #icon-express
  • eye
    #icon-eye
  • no_eye
    #icon-no_eye
  • face recognition
    #icon-facerecognition
  • fill in
    #icon-fillin
  • folder
    #icon-folder
  • me
    #icon-me
  • friends_add
    #icon-friends_add
  • Friend settings
    #icon-Friendsettings
  • address book
    #icon-addressbook
  • pepole
    #icon-pepole
  • friend_delete
    #icon-friend_delete
  • friend_delete_2
    #icon-friend_delete_2
  • address
    #icon-address
  • friend_settings
    #icon-friend_settings
  • gift
    #icon-gift
  • good
    #icon-good
  • home
    #icon-home
  • huititle
    #icon-huititle
  • information_add
    #icon-information_add
  • fill in
    #icon-fillin1
  • key
    #icon-key
  • lock
    #icon-lock
  • koubei
    #icon-koubei
  • link
    #icon-link
  • live
    #icon-live
  • location
    #icon-location
  • logo
    #icon-logo
  • loop
    #icon-loop
  • mail
    #icon-mail
  • open mail
    #icon-openmail
  • mark
    #icon-mark
  • more
    #icon-more1
  • movie
    #icon-movie
  • payment
    #icon-payment
  • picture
    #icon-picture
  • play
    #icon-play
  • live
    #icon-live1
  • red packet
    #icon-redpacket
  • refresh
    #icon-refresh
  • loop
    #icon-loop1
  • search
    #icon-search
  • send
    #icon-send
  • fill in
    #icon-fillin2
  • information_add
    #icon-information_add1
  • shop
    #icon-shop
  • slice
    #icon-slice
  • target
    #icon-target
  • text deletion
    #icon-textdeletion
  • text
    #icon-text
  • trash
    #icon-trash
  • type
    #icon-type
  • upload
    #icon-upload1
  • wallet
    #icon-wallet
  • zoom out
    #icon-zoomout
  • zoom
    #icon-zoom
  • system-QRcode
    #icon-system-QRcode
  • system-phonebook
    #icon-system-phonebook

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>