• check
    
  • close
    
  • emoji
    
  • favor_fill
    
  • favor
    
  • loading
    
  • location_fill
    
  • location
    
  • round_check_fill
    
  • round_check
    
  • round_close_fill
    
  • round_close
    
  • round_right_fill
    
  • round_right
    
  • search
    
  • time_fill
    
  • time
    
  • unfold
    
  • warn_fill
    
  • warn
    
  • camera_fill
    
  • camera
    
  • comment_fill
    
  • comment
    
  • back
    
  • cascades
    
  • list
    
  • more
    
  • scan
    
  • settings
    
  • pic
    
  • top
    
  • pull_down
    
  • pull_up
    
  • right
    
  • refresh
    
  • more_android
    
  • delete_fill
    
  • cart
    
  • delete
    
  • home
    
  • cart_fill
    
  • home_fill
    
  • message
    
  • lock
    
  • unlock
    
  • square_check_fill
    
  • square
    
  • square_check
    
  • round
    
  • add
    
  • fold
    
  • info_fill
    
  • info
    
  • share
    
  • search_list
    
  • sort
    
  • down
    
  • mobile
    
  • mobile_fill
    
  • countdown_fill
    
  • countdown
    
  • keyboard
    
  • pull_left
    
  • pull_right
    
  • pic_fill
    
  • refresh_arrow
    
  • attention_fill
    
  • attention
    
  • tag_fill
    
  • tag
    
  • radio_box
    
  • upload
    
  • radio_box_fill
    
  • move
    
  • message_fill
    
  • my
    
  • my_fill
    
  • triangle_down_fill
    
  • triangle_up_fill
    
  • loading
    
  • emoji_light
    
  • keyboard_light
    
  • sort_light
    
  • attention_forbid
    
  • attention_forbid_fill
    
  • pic_light
    
  • loading
    
  • usefull_fill
    
  • usefull
    
  • home_light
    
  • my_light
    
  • cart_light
    
  • home_fill_light
    
  • cart_fill_light
    
  • my_fill_light
    
  • search_light
    
  • scan_light
    
  • message_light
    
  • close_light
    
  • camera_light
    
  • refresh_light
    
  • back_light
    
  • share_light
    
  • comment_light
    
  • favor_light
    
  • comment_fill_light
    
  • more_android_light
    
  • more_light
    
  • message_fill_light
    
  • search_list_light
    
  • favor_fill_light
    
  • delete_light
    
  • back_android
    
  • back_android_light
    
  • down_light
    
  • round_close_light
    
  • round_close_fill_light
    
  • location_light
    
  • settings_light
    
  • Loading
    
  • warn_light
    

Unicode 引用


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

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

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

Unicode 使用步骤如下:

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

@font-face {
  font-family: 'cd_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#cd_iconfont') format('svg');
}

第二步:定义使用 iconfont 的样式

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

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

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

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

  • check
    .icon-check
  • close
    .icon-close
  • emoji
    .icon-emoji
  • favor_fill
    .icon-favorfill
  • favor
    .icon-favor
  • loading
    .icon-loading
  • location_fill
    .icon-locationfill
  • location
    .icon-location
  • round_check_fill
    .icon-roundcheckfill
  • round_check
    .icon-roundcheck
  • round_close_fill
    .icon-roundclosefill
  • round_close
    .icon-roundclose
  • round_right_fill
    .icon-roundrightfill
  • round_right
    .icon-roundright
  • search
    .icon-search
  • time_fill
    .icon-timefill
  • time
    .icon-time
  • unfold
    .icon-unfold
  • warn_fill
    .icon-warnfill
  • warn
    .icon-warn
  • camera_fill
    .icon-camerafill
  • camera
    .icon-camera
  • comment_fill
    .icon-commentfill
  • comment
    .icon-comment
  • back
    .icon-back
  • cascades
    .icon-cascades
  • list
    .icon-list
  • more
    .icon-more
  • scan
    .icon-scan
  • settings
    .icon-settings
  • pic
    .icon-pic
  • top
    .icon-top
  • pull_down
    .icon-pulldown
  • pull_up
    .icon-pullup
  • right
    .icon-right
  • refresh
    .icon-refresh
  • more_android
    .icon-moreandroid
  • delete_fill
    .icon-deletefill
  • cart
    .icon-cart
  • delete
    .icon-delete
  • home
    .icon-home
  • cart_fill
    .icon-cartfill
  • home_fill
    .icon-homefill
  • message
    .icon-message
  • lock
    .icon-lock
  • unlock
    .icon-unlock
  • square_check_fill
    .icon-squarecheckfill
  • square
    .icon-square
  • square_check
    .icon-squarecheck
  • round
    .icon-round
  • add
    .icon-add
  • fold
    .icon-fold
  • info_fill
    .icon-infofill
  • info
    .icon-info
  • share
    .icon-share
  • search_list
    .icon-searchlist
  • sort
    .icon-sort
  • down
    .icon-down
  • mobile
    .icon-mobile
  • mobile_fill
    .icon-mobilefill
  • countdown_fill
    .icon-countdownfill
  • countdown
    .icon-countdown
  • keyboard
    .icon-keyboard
  • pull_left
    .icon-pullleft
  • pull_right
    .icon-pullright
  • pic_fill
    .icon-picfill
  • refresh_arrow
    .icon-refresharrow
  • attention_fill
    .icon-attentionfill
  • attention
    .icon-attention
  • tag_fill
    .icon-tagfill
  • tag
    .icon-tag
  • radio_box
    .icon-radiobox
  • upload
    .icon-upload
  • radio_box_fill
    .icon-radioboxfill
  • move
    .icon-move
  • message_fill
    .icon-messagefill
  • my
    .icon-my
  • my_fill
    .icon-myfill
  • triangle_down_fill
    .icon-triangledownfill
  • triangle_up_fill
    .icon-triangleupfill
  • loading
    .icon-loading1
  • emoji_light
    .icon-emojilight
  • keyboard_light
    .icon-keyboardlight
  • sort_light
    .icon-sortlight
  • attention_forbid
    .icon-attentionforbid
  • attention_forbid_fill
    .icon-attentionforbidfill
  • pic_light
    .icon-piclight
  • loading
    .icon-loadBrush
  • usefull_fill
    .icon-usefullfill
  • usefull
    .icon-usefull
  • home_light
    .icon-home_light
  • my_light
    .icon-my_light
  • cart_light
    .icon-cart_light
  • home_fill_light
    .icon-home_fill_light
  • cart_fill_light
    .icon-cart_fill_light
  • my_fill_light
    .icon-my_fill_light
  • search_light
    .icon-search_light
  • scan_light
    .icon-scan_light
  • message_light
    .icon-message_light
  • close_light
    .icon-close_light
  • camera_light
    .icon-camera_light
  • refresh_light
    .icon-refresh_light
  • back_light
    .icon-back_light
  • share_light
    .icon-share_light
  • comment_light
    .icon-comment_light
  • favor_light
    .icon-favor_light
  • comment_fill_light
    .icon-comment_fill_light
  • more_android_light
    .icon-more_android_light
  • more_light
    .icon-more_light
  • message_fill_light
    .icon-message_fill_light
  • search_list_light
    .icon-search_list_light
  • favor_fill_light
    .icon-favor_fill_light
  • delete_light
    .icon-delete_light
  • back_android
    .icon-back_android
  • back_android_light
    .icon-back_android_light
  • down_light
    .icon-down_light
  • round_close_light
    .icon-round_close_light
  • round_close_fill_light
    .icon-round_close_fill_light
  • location_light
    .icon-location_light
  • settings_light
    .icon-settings_light
  • Loading
    .icon-Loading
  • warn_light
    .icon-warn_light

font-class 引用


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

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

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

使用步骤如下:

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

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

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

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

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

  • check
    #icon-check
  • close
    #icon-close
  • emoji
    #icon-emoji
  • favor_fill
    #icon-favorfill
  • favor
    #icon-favor
  • loading
    #icon-loading
  • location_fill
    #icon-locationfill
  • location
    #icon-location
  • round_check_fill
    #icon-roundcheckfill
  • round_check
    #icon-roundcheck
  • round_close_fill
    #icon-roundclosefill
  • round_close
    #icon-roundclose
  • round_right_fill
    #icon-roundrightfill
  • round_right
    #icon-roundright
  • search
    #icon-search
  • time_fill
    #icon-timefill
  • time
    #icon-time
  • unfold
    #icon-unfold
  • warn_fill
    #icon-warnfill
  • warn
    #icon-warn
  • camera_fill
    #icon-camerafill
  • camera
    #icon-camera
  • comment_fill
    #icon-commentfill
  • comment
    #icon-comment
  • back
    #icon-back
  • cascades
    #icon-cascades
  • list
    #icon-list
  • more
    #icon-more
  • scan
    #icon-scan
  • settings
    #icon-settings
  • pic
    #icon-pic
  • top
    #icon-top
  • pull_down
    #icon-pulldown
  • pull_up
    #icon-pullup
  • right
    #icon-right
  • refresh
    #icon-refresh
  • more_android
    #icon-moreandroid
  • delete_fill
    #icon-deletefill
  • cart
    #icon-cart
  • delete
    #icon-delete
  • home
    #icon-home
  • cart_fill
    #icon-cartfill
  • home_fill
    #icon-homefill
  • message
    #icon-message
  • lock
    #icon-lock
  • unlock
    #icon-unlock
  • square_check_fill
    #icon-squarecheckfill
  • square
    #icon-square
  • square_check
    #icon-squarecheck
  • round
    #icon-round
  • add
    #icon-add
  • fold
    #icon-fold
  • info_fill
    #icon-infofill
  • info
    #icon-info
  • share
    #icon-share
  • search_list
    #icon-searchlist
  • sort
    #icon-sort
  • down
    #icon-down
  • mobile
    #icon-mobile
  • mobile_fill
    #icon-mobilefill
  • countdown_fill
    #icon-countdownfill
  • countdown
    #icon-countdown
  • keyboard
    #icon-keyboard
  • pull_left
    #icon-pullleft
  • pull_right
    #icon-pullright
  • pic_fill
    #icon-picfill
  • refresh_arrow
    #icon-refresharrow
  • attention_fill
    #icon-attentionfill
  • attention
    #icon-attention
  • tag_fill
    #icon-tagfill
  • tag
    #icon-tag
  • radio_box
    #icon-radiobox
  • upload
    #icon-upload
  • radio_box_fill
    #icon-radioboxfill
  • move
    #icon-move
  • message_fill
    #icon-messagefill
  • my
    #icon-my
  • my_fill
    #icon-myfill
  • triangle_down_fill
    #icon-triangledownfill
  • triangle_up_fill
    #icon-triangleupfill
  • loading
    #icon-loading1
  • emoji_light
    #icon-emojilight
  • keyboard_light
    #icon-keyboardlight
  • sort_light
    #icon-sortlight
  • attention_forbid
    #icon-attentionforbid
  • attention_forbid_fill
    #icon-attentionforbidfill
  • pic_light
    #icon-piclight
  • loading
    #icon-loadBrush
  • usefull_fill
    #icon-usefullfill
  • usefull
    #icon-usefull
  • home_light
    #icon-home_light
  • my_light
    #icon-my_light
  • cart_light
    #icon-cart_light
  • home_fill_light
    #icon-home_fill_light
  • cart_fill_light
    #icon-cart_fill_light
  • my_fill_light
    #icon-my_fill_light
  • search_light
    #icon-search_light
  • scan_light
    #icon-scan_light
  • message_light
    #icon-message_light
  • close_light
    #icon-close_light
  • camera_light
    #icon-camera_light
  • refresh_light
    #icon-refresh_light
  • back_light
    #icon-back_light
  • share_light
    #icon-share_light
  • comment_light
    #icon-comment_light
  • favor_light
    #icon-favor_light
  • comment_fill_light
    #icon-comment_fill_light
  • more_android_light
    #icon-more_android_light
  • more_light
    #icon-more_light
  • message_fill_light
    #icon-message_fill_light
  • search_list_light
    #icon-search_list_light
  • favor_fill_light
    #icon-favor_fill_light
  • delete_light
    #icon-delete_light
  • back_android
    #icon-back_android
  • back_android_light
    #icon-back_android_light
  • down_light
    #icon-down_light
  • round_close_light
    #icon-round_close_light
  • round_close_fill_light
    #icon-round_close_fill_light
  • location_light
    #icon-location_light
  • settings_light
    #icon-settings_light
  • Loading
    #icon-Loading
  • warn_light
    #icon-warn_light

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>