• checked
    
  • checklist
    
  • check-disabled
    
  • check-normal
    
  • check-checked
    
  • loading
    
  • heart-n
    
  • star-fill-n
    
  • heart-fill-n
    
  • star-n
    
  • heart
    
  • heart
    
  • heart-fill
    
  • heart-fill
    
  • heart-fill1
    
  • star-fill
    
  • star
    
  • star
    
  • star-fill
    
  • share-n
    
  • horizontal-n
    
  • more-x
    
  • more-s
    
  • star-fill
    
  • star
    
  • heart
    
  • heart-fill
    
  • retweet
    
  • poweroff-circle-fill
    
  • play-circle-fill
    
  • down-arrow
    
  • success
    
  • failure
    
  • issue
    
  • Check
    
  • plus
    
  • minus
    
  • arrow-up2
    
  • arrow-down2
    
  • screen-little
    
  • arrow-right2
    
  • close-little
    
  • joy-smile
    
  • arrow-down
    
  • arrow-right
    
  • arrow-up
    
  • github
    
  • uplode
    
  • mask-close
    
  • circle-close
    
  • right
    
  • jdl
    
  • order
    
  • refresh
    
  • add
    
  • JD
    
  • eye
    
  • dshop
    
  • my2
    
  • star
    
  • del2
    
  • comment
    
  • microphone
    
  • people
    
  • service
    
  • cart2
    
  • location2
    
  • marshalling
    
  • fabulous
    
  • s-follow
    
  • shop
    
  • message
    
  • ask2
    
  • search2
    
  • clock
    
  • setting
    
  • refresh2
    
  • horizontal
    
  • date
    
  • photograph
    
  • link
    
  • scan2
    
  • left
    
  • close
    
  • locationg3
    
  • share
    
  • shop3
    
  • more
    
  • ask
    
  • tips
    
  • notice
    
  • lower
    
  • top
    
  • download
    
  • dongdong
    
  • JIMI40
    
  • location
    
  • scan
    
  • addfollow
    
  • search
    
  • share
    
  • follow
    
  • del
    
  • edit
    
  • cart
    
  • home
    
  • find
    
  • category
    
  • my
    
  • footprint
    

Unicode 引用


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

  • 支持按字体的方式去动态调整图标大小,颜色等等。
  • 默认情况下不支持多色,直接添加多色图标会自动去色。

注意:新版 iconfont 支持两种方式引用多色图标:SVG symbol 引用方式和彩色字体图标模式。(使用彩色字体图标需要在「编辑项目」中开启「彩色」选项后并重新生成。)

Unicode 使用步骤如下:

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

@font-face {
  font-family: 'nutui-iconfont';
  src: url('iconfont.woff2?t=1620383008438') format('woff2'),
       url('iconfont.woff?t=1620383008438') format('woff'),
       url('iconfont.ttf?t=1620383008438') format('truetype');
}

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

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

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

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

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

  • checked
    .nut-icon-checked
  • checklist
    .nut-icon-checklist
  • check-disabled
    .nut-icon-check-disabled
  • check-normal
    .nut-icon-check-normal
  • check-checked
    .nut-icon-check-checked
  • loading
    .nut-icon-loading
  • heart-n
    .nut-icon-heart-n
  • star-fill-n
    .nut-icon-star-fill-n
  • heart-fill-n
    .nut-icon-heart-fill-n
  • star-n
    .nut-icon-star-n
  • heart
    .nut-icon-heart
  • heart
    .nut-icon-heart1
  • heart-fill
    .nut-icon-heart-fill
  • heart-fill
    .nut-icon-heart-fill2
  • heart-fill1
    .nut-icon-heart-fill1
  • star-fill
    .nut-icon-star-fill2
  • star
    .nut-icon-star11
  • star
    .nut-icon-star1
  • star-fill
    .nut-icon-star-fill
  • share-n
    .nut-icon-share-n
  • horizontal-n
    .nut-icon-horizontal-n
  • more-x
    .nut-icon-more-x
  • more-s
    .nut-icon-more-s
  • star-fill
    .nut-icon-star-fill1
  • star
    .nut-icon-star2
  • heart
    .nut-icon-heart2
  • heart-fill
    .nut-icon-heart-fill3
  • retweet
    .nut-icon-retweet
  • poweroff-circle-fill
    .nut-icon-poweroff-circle-fill
  • play-circle-fill
    .nut-icon-play-circle-fill
  • down-arrow
    .nut-icon-down-arrow
  • success
    .nut-icon-success
  • failure
    .nut-icon-failure
  • issue
    .nut-icon-issue
  • Check
    .nut-icon-Check
  • plus
    .nut-icon-plus
  • minus
    .nut-icon-minus
  • arrow-up2
    .nut-icon-arrow-up2
  • arrow-down2
    .nut-icon-arrow-down2
  • screen-little
    .nut-icon-screen-little
  • arrow-right2
    .nut-icon-arrow-right2
  • close-little
    .nut-icon-close-little
  • joy-smile
    .nut-icon-joy-smile
  • arrow-down
    .nut-icon-arrow-down
  • arrow-right
    .nut-icon-arrow-right
  • arrow-up
    .nut-icon-arrow-up
  • github
    .nut-icon-github
  • uplode
    .nut-icon-uploader
  • mask-close
    .nut-icon-mask-close
  • circle-close
    .nut-icon-circle-close
  • right
    .nut-icon-right
  • jdl
    .nut-icon-jdl
  • order
    .nut-icon-order
  • refresh
    .nut-icon-refresh
  • add
    .nut-icon-add
  • JD
    .nut-icon-JD
  • eye
    .nut-icon-eye
  • dshop
    .nut-icon-dshop
  • my2
    .nut-icon-my2
  • star
    .nut-icon-star
  • del2
    .nut-icon-del2
  • comment
    .nut-icon-comment
  • microphone
    .nut-icon-microphone
  • people
    .nut-icon-people
  • service
    .nut-icon-service
  • cart2
    .nut-icon-cart2
  • location2
    .nut-icon-location2
  • marshalling
    .nut-icon-marshalling
  • fabulous
    .nut-icon-fabulous
  • s-follow
    .nut-icon-s-follow
  • shop
    .nut-icon-shop
  • message
    .nut-icon-message
  • ask2
    .nut-icon-ask2
  • search2
    .nut-icon-search2
  • clock
    .nut-icon-clock
  • setting
    .nut-icon-setting
  • refresh2
    .nut-icon-refresh2
  • horizontal
    .nut-icon-horizontal
  • date
    .nut-icon-date
  • photograph
    .nut-icon-photograph
  • link
    .nut-icon-link
  • scan2
    .nut-icon-scan2
  • left
    .nut-icon-left
  • close
    .nut-icon-close
  • locationg3
    .nut-icon-locationg3
  • share
    .nut-icon-share1
  • shop3
    .nut-icon-shop3
  • more
    .nut-icon-more
  • ask
    .nut-icon-ask
  • tips
    .nut-icon-tips
  • notice
    .nut-icon-notice
  • lower
    .nut-icon-lower
  • top
    .nut-icon-top
  • download
    .nut-icon-download
  • dongdong
    .nut-icon-dongdong
  • JIMI40
    .nut-icon-JIMI40
  • location
    .nut-icon-location
  • scan
    .nut-icon-scan
  • addfollow
    .nut-icon-addfollow
  • search
    .nut-icon-search
  • share
    .nut-icon-share
  • follow
    .nut-icon-follow
  • del
    .nut-icon-del
  • edit
    .nut-icon-edit
  • cart
    .nut-icon-cart
  • home
    .nut-icon-home
  • find
    .nut-icon-find
  • category
    .nut-icon-category
  • my
    .nut-icon-my
  • footprint
    .nut-icon-footprint

font-class 引用


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

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

  • 相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。
  • 因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。

使用步骤如下:

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

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

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

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

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

  • checked
    #nut-icon-checked
  • checklist
    #nut-icon-checklist
  • check-disabled
    #nut-icon-check-disabled
  • check-normal
    #nut-icon-check-normal
  • check-checked
    #nut-icon-check-checked
  • loading
    #nut-icon-loading
  • heart-n
    #nut-icon-heart-n
  • star-fill-n
    #nut-icon-star-fill-n
  • heart-fill-n
    #nut-icon-heart-fill-n
  • star-n
    #nut-icon-star-n
  • heart
    #nut-icon-heart
  • heart
    #nut-icon-heart1
  • heart-fill
    #nut-icon-heart-fill
  • heart-fill
    #nut-icon-heart-fill2
  • heart-fill1
    #nut-icon-heart-fill1
  • star-fill
    #nut-icon-star-fill2
  • star
    #nut-icon-star11
  • star
    #nut-icon-star1
  • star-fill
    #nut-icon-star-fill
  • share-n
    #nut-icon-share-n
  • horizontal-n
    #nut-icon-horizontal-n
  • more-x
    #nut-icon-more-x
  • more-s
    #nut-icon-more-s
  • star-fill
    #nut-icon-star-fill1
  • star
    #nut-icon-star2
  • heart
    #nut-icon-heart2
  • heart-fill
    #nut-icon-heart-fill3
  • retweet
    #nut-icon-retweet
  • poweroff-circle-fill
    #nut-icon-poweroff-circle-fill
  • play-circle-fill
    #nut-icon-play-circle-fill
  • down-arrow
    #nut-icon-down-arrow
  • success
    #nut-icon-success
  • failure
    #nut-icon-failure
  • issue
    #nut-icon-issue
  • Check
    #nut-icon-Check
  • plus
    #nut-icon-plus
  • minus
    #nut-icon-minus
  • arrow-up2
    #nut-icon-arrow-up2
  • arrow-down2
    #nut-icon-arrow-down2
  • screen-little
    #nut-icon-screen-little
  • arrow-right2
    #nut-icon-arrow-right2
  • close-little
    #nut-icon-close-little
  • joy-smile
    #nut-icon-joy-smile
  • arrow-down
    #nut-icon-arrow-down
  • arrow-right
    #nut-icon-arrow-right
  • arrow-up
    #nut-icon-arrow-up
  • github
    #nut-icon-github
  • uplode
    #nut-icon-uploader
  • mask-close
    #nut-icon-mask-close
  • circle-close
    #nut-icon-circle-close
  • right
    #nut-icon-right
  • jdl
    #nut-icon-jdl
  • order
    #nut-icon-order
  • refresh
    #nut-icon-refresh
  • add
    #nut-icon-add
  • JD
    #nut-icon-JD
  • eye
    #nut-icon-eye
  • dshop
    #nut-icon-dshop
  • my2
    #nut-icon-my2
  • star
    #nut-icon-star
  • del2
    #nut-icon-del2
  • comment
    #nut-icon-comment
  • microphone
    #nut-icon-microphone
  • people
    #nut-icon-people
  • service
    #nut-icon-service
  • cart2
    #nut-icon-cart2
  • location2
    #nut-icon-location2
  • marshalling
    #nut-icon-marshalling
  • fabulous
    #nut-icon-fabulous
  • s-follow
    #nut-icon-s-follow
  • shop
    #nut-icon-shop
  • message
    #nut-icon-message
  • ask2
    #nut-icon-ask2
  • search2
    #nut-icon-search2
  • clock
    #nut-icon-clock
  • setting
    #nut-icon-setting
  • refresh2
    #nut-icon-refresh2
  • horizontal
    #nut-icon-horizontal
  • date
    #nut-icon-date
  • photograph
    #nut-icon-photograph
  • link
    #nut-icon-link
  • scan2
    #nut-icon-scan2
  • left
    #nut-icon-left
  • close
    #nut-icon-close
  • locationg3
    #nut-icon-locationg3
  • share
    #nut-icon-share1
  • shop3
    #nut-icon-shop3
  • more
    #nut-icon-more
  • ask
    #nut-icon-ask
  • tips
    #nut-icon-tips
  • notice
    #nut-icon-notice
  • lower
    #nut-icon-lower
  • top
    #nut-icon-top
  • download
    #nut-icon-download
  • dongdong
    #nut-icon-dongdong
  • JIMI40
    #nut-icon-JIMI40
  • location
    #nut-icon-location
  • scan
    #nut-icon-scan
  • addfollow
    #nut-icon-addfollow
  • search
    #nut-icon-search
  • share
    #nut-icon-share
  • follow
    #nut-icon-follow
  • del
    #nut-icon-del
  • edit
    #nut-icon-edit
  • cart
    #nut-icon-cart
  • home
    #nut-icon-home
  • find
    #nut-icon-find
  • category
    #nut-icon-category
  • my
    #nut-icon-my
  • footprint
    #nut-icon-footprint

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>