demo_index.html 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>iconfont Demo</title>
  6. <link rel="shortcut icon" href="//img.alicdn.com/imgextra/i2/O1CN01ZyAlrn1MwaMhqz36G_!!6000000001499-73-tps-64-64.ico" type="image/x-icon"/>
  7. <link rel="icon" type="image/svg+xml" href="//img.alicdn.com/imgextra/i4/O1CN01EYTRnJ297D6vehehJ_!!6000000008020-55-tps-64-64.svg"/>
  8. <link rel="stylesheet" href="https://g.alicdn.com/thx/cube/1.3.2/cube.min.css">
  9. <link rel="stylesheet" href="demo.css">
  10. <link rel="stylesheet" href="iconfont.css">
  11. <script src="iconfont.js"></script>
  12. <!-- jQuery -->
  13. <script src="https://a1.alicdn.com/oss/uploads/2018/12/26/7bfddb60-08e8-11e9-9b04-53e73bb6408b.js"></script>
  14. <!-- 代码高亮 -->
  15. <script src="https://a1.alicdn.com/oss/uploads/2018/12/26/a3f714d0-08e6-11e9-8a15-ebf944d7534c.js"></script>
  16. <style>
  17. .main .logo {
  18. margin-top: 0;
  19. height: auto;
  20. }
  21. .main .logo a {
  22. display: flex;
  23. align-items: center;
  24. }
  25. .main .logo .sub-title {
  26. margin-left: 0.5em;
  27. font-size: 22px;
  28. color: #fff;
  29. background: linear-gradient(-45deg, #3967FF, #B500FE);
  30. -webkit-background-clip: text;
  31. -webkit-text-fill-color: transparent;
  32. }
  33. </style>
  34. </head>
  35. <body>
  36. <div class="main">
  37. <h1 class="logo"><a href="https://www.iconfont.cn/" title="iconfont 首页" target="_blank">
  38. <img width="200" src="https://img.alicdn.com/imgextra/i3/O1CN01Mn65HV1FfSEzR6DKv_!!6000000000514-55-tps-228-59.svg">
  39. </a></h1>
  40. <div class="nav-tabs">
  41. <ul id="tabs" class="dib-box">
  42. <li class="dib active"><span>Unicode</span></li>
  43. <li class="dib"><span>Font class</span></li>
  44. <li class="dib"><span>Symbol</span></li>
  45. </ul>
  46. <a href="https://www.iconfont.cn/manage/index?manage_type=myprojects&projectId=2554236" target="_blank" class="nav-more">查看项目</a>
  47. </div>
  48. <div class="tab-container">
  49. <div class="content unicode" style="display: block;">
  50. <ul class="icon_lists dib-box">
  51. <li class="dib">
  52. <span class="icon iconfont">&#xe615;</span>
  53. <div class="name">kehuzijin</div>
  54. <div class="code-name">&amp;#xe615;</div>
  55. </li>
  56. <li class="dib">
  57. <span class="icon iconfont">&#xe614;</span>
  58. <div class="name">shougou</div>
  59. <div class="code-name">&amp;#xe614;</div>
  60. </li>
  61. <li class="dib">
  62. <span class="icon iconfont">&#xe613;</span>
  63. <div class="name">chukuguanli备份</div>
  64. <div class="code-name">&amp;#xe613;</div>
  65. </li>
  66. <li class="dib">
  67. <span class="icon iconfont">&#xe612;</span>
  68. <div class="name">gongzuotongzi</div>
  69. <div class="code-name">&amp;#xe612;</div>
  70. </li>
  71. <li class="dib">
  72. <span class="icon iconfont">&#xe610;</span>
  73. <div class="name">kehuguanli</div>
  74. <div class="code-name">&amp;#xe610;</div>
  75. </li>
  76. <li class="dib">
  77. <span class="icon iconfont">&#xe60f;</span>
  78. <div class="name">caiwuguanli</div>
  79. <div class="code-name">&amp;#xe60f;</div>
  80. </li>
  81. <li class="dib">
  82. <span class="icon iconfont">&#xe60e;</span>
  83. <div class="name">shenhe</div>
  84. <div class="code-name">&amp;#xe60e;</div>
  85. </li>
  86. <li class="dib">
  87. <span class="icon iconfont">&#xe60d;</span>
  88. <div class="name">caigouguanli</div>
  89. <div class="code-name">&amp;#xe60d;</div>
  90. </li>
  91. <li class="dib">
  92. <span class="icon iconfont">&#xe60c;</span>
  93. <div class="name">xiaoshou2</div>
  94. <div class="code-name">&amp;#xe60c;</div>
  95. </li>
  96. <li class="dib">
  97. <span class="icon iconfont">&#xe60b;</span>
  98. <div class="name">tongjibaobiao</div>
  99. <div class="code-name">&amp;#xe60b;</div>
  100. </li>
  101. <li class="dib">
  102. <span class="icon iconfont">&#xe641;</span>
  103. <div class="name">对</div>
  104. <div class="code-name">&amp;#xe641;</div>
  105. </li>
  106. <li class="dib">
  107. <span class="icon iconfont">&#xe60a;</span>
  108. <div class="name">招粮云仓</div>
  109. <div class="code-name">&amp;#xe60a;</div>
  110. </li>
  111. <li class="dib">
  112. <span class="icon iconfont">&#xe605;</span>
  113. <div class="name">历史</div>
  114. <div class="code-name">&amp;#xe605;</div>
  115. </li>
  116. <li class="dib">
  117. <span class="icon iconfont">&#xe6c9;</span>
  118. <div class="name">关 闭</div>
  119. <div class="code-name">&amp;#xe6c9;</div>
  120. </li>
  121. <li class="dib">
  122. <span class="icon iconfont">&#xe63a;</span>
  123. <div class="name">眼睛-睁眼</div>
  124. <div class="code-name">&amp;#xe63a;</div>
  125. </li>
  126. <li class="dib">
  127. <span class="icon iconfont">&#xe63b;</span>
  128. <div class="name">眼睛-闭眼</div>
  129. <div class="code-name">&amp;#xe63b;</div>
  130. </li>
  131. <li class="dib">
  132. <span class="icon iconfont">&#xe609;</span>
  133. <div class="name">yunshuguanli</div>
  134. <div class="code-name">&amp;#xe609;</div>
  135. </li>
  136. <li class="dib">
  137. <span class="icon iconfont">&#xe601;</span>
  138. <div class="name">hetong</div>
  139. <div class="code-name">&amp;#xe601;</div>
  140. </li>
  141. <li class="dib">
  142. <span class="icon iconfont">&#xe602;</span>
  143. <div class="name">index</div>
  144. <div class="code-name">&amp;#xe602;</div>
  145. </li>
  146. <li class="dib">
  147. <span class="icon iconfont">&#xe603;</span>
  148. <div class="name">shouqi</div>
  149. <div class="code-name">&amp;#xe603;</div>
  150. </li>
  151. <li class="dib">
  152. <span class="icon iconfont">&#xe604;</span>
  153. <div class="name">zhankai</div>
  154. <div class="code-name">&amp;#xe604;</div>
  155. </li>
  156. <li class="dib">
  157. <span class="icon iconfont">&#xe606;</span>
  158. <div class="name">cangku</div>
  159. <div class="code-name">&amp;#xe606;</div>
  160. </li>
  161. <li class="dib">
  162. <span class="icon iconfont">&#xe607;</span>
  163. <div class="name">renwuguanli</div>
  164. <div class="code-name">&amp;#xe607;</div>
  165. </li>
  166. </ul>
  167. <div class="article markdown">
  168. <h2 id="unicode-">Unicode 引用</h2>
  169. <hr>
  170. <p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
  171. <ul>
  172. <li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
  173. <li>默认情况下不支持多色,直接添加多色图标会自动去色。</li>
  174. </ul>
  175. <blockquote>
  176. <p>注意:新版 iconfont 支持两种方式引用多色图标:SVG symbol 引用方式和彩色字体图标模式。(使用彩色字体图标需要在「编辑项目」中开启「彩色」选项后并重新生成。)</p>
  177. </blockquote>
  178. <p>Unicode 使用步骤如下:</p>
  179. <h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
  180. <pre><code class="language-css"
  181. >@font-face {
  182. font-family: 'iconfont';
  183. src: url('iconfont.woff2?t=1635728227466') format('woff2'),
  184. url('iconfont.woff?t=1635728227466') format('woff'),
  185. url('iconfont.ttf?t=1635728227466') format('truetype');
  186. }
  187. </code></pre>
  188. <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
  189. <pre><code class="language-css"
  190. >.iconfont {
  191. font-family: "iconfont" !important;
  192. font-size: 16px;
  193. font-style: normal;
  194. -webkit-font-smoothing: antialiased;
  195. -moz-osx-font-smoothing: grayscale;
  196. }
  197. </code></pre>
  198. <h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
  199. <pre>
  200. <code class="language-html"
  201. >&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
  202. </code></pre>
  203. <blockquote>
  204. <p>"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
  205. </blockquote>
  206. </div>
  207. </div>
  208. <div class="content font-class">
  209. <ul class="icon_lists dib-box">
  210. <li class="dib">
  211. <span class="icon iconfont icon-kehuzijin"></span>
  212. <div class="name">
  213. kehuzijin
  214. </div>
  215. <div class="code-name">.icon-kehuzijin
  216. </div>
  217. </li>
  218. <li class="dib">
  219. <span class="icon iconfont icon-a-4-shougoubeifen"></span>
  220. <div class="name">
  221. shougou
  222. </div>
  223. <div class="code-name">.icon-a-4-shougoubeifen
  224. </div>
  225. </li>
  226. <li class="dib">
  227. <span class="icon iconfont icon-chukuguanlibeifen"></span>
  228. <div class="name">
  229. chukuguanli备份
  230. </div>
  231. <div class="code-name">.icon-chukuguanlibeifen
  232. </div>
  233. </li>
  234. <li class="dib">
  235. <span class="icon iconfont icon-a-tongzhibeifen2"></span>
  236. <div class="name">
  237. gongzuotongzi
  238. </div>
  239. <div class="code-name">.icon-a-tongzhibeifen2
  240. </div>
  241. </li>
  242. <li class="dib">
  243. <span class="icon iconfont icon-kehuguanli"></span>
  244. <div class="name">
  245. kehuguanli
  246. </div>
  247. <div class="code-name">.icon-kehuguanli
  248. </div>
  249. </li>
  250. <li class="dib">
  251. <span class="icon iconfont icon-caiwuguanli"></span>
  252. <div class="name">
  253. caiwuguanli
  254. </div>
  255. <div class="code-name">.icon-caiwuguanli
  256. </div>
  257. </li>
  258. <li class="dib">
  259. <span class="icon iconfont icon-shenhe"></span>
  260. <div class="name">
  261. shenhe
  262. </div>
  263. <div class="code-name">.icon-shenhe
  264. </div>
  265. </li>
  266. <li class="dib">
  267. <span class="icon iconfont icon-caigouguanli"></span>
  268. <div class="name">
  269. caigouguanli
  270. </div>
  271. <div class="code-name">.icon-caigouguanli
  272. </div>
  273. </li>
  274. <li class="dib">
  275. <span class="icon iconfont icon-xiaoshou2"></span>
  276. <div class="name">
  277. xiaoshou2
  278. </div>
  279. <div class="code-name">.icon-xiaoshou2
  280. </div>
  281. </li>
  282. <li class="dib">
  283. <span class="icon iconfont icon-tongjibaobiao"></span>
  284. <div class="name">
  285. tongjibaobiao
  286. </div>
  287. <div class="code-name">.icon-tongjibaobiao
  288. </div>
  289. </li>
  290. <li class="dib">
  291. <span class="icon iconfont icon-dui"></span>
  292. <div class="name">
  293. </div>
  294. <div class="code-name">.icon-dui
  295. </div>
  296. </li>
  297. <li class="dib">
  298. <span class="icon iconfont icon-yiliangyiyun"></span>
  299. <div class="name">
  300. 招粮云仓
  301. </div>
  302. <div class="code-name">.icon-yiliangyiyun
  303. </div>
  304. </li>
  305. <li class="dib">
  306. <span class="icon iconfont icon-lishi"></span>
  307. <div class="name">
  308. 历史
  309. </div>
  310. <div class="code-name">.icon-lishi
  311. </div>
  312. </li>
  313. <li class="dib">
  314. <span class="icon iconfont icon-guanbi"></span>
  315. <div class="name">
  316. 关 闭
  317. </div>
  318. <div class="code-name">.icon-guanbi
  319. </div>
  320. </li>
  321. <li class="dib">
  322. <span class="icon iconfont icon-yanjing-zhengyan"></span>
  323. <div class="name">
  324. 眼睛-睁眼
  325. </div>
  326. <div class="code-name">.icon-yanjing-zhengyan
  327. </div>
  328. </li>
  329. <li class="dib">
  330. <span class="icon iconfont icon-yanjing-biyan"></span>
  331. <div class="name">
  332. 眼睛-闭眼
  333. </div>
  334. <div class="code-name">.icon-yanjing-biyan
  335. </div>
  336. </li>
  337. <li class="dib">
  338. <span class="icon iconfont icon-yunshu2"></span>
  339. <div class="name">
  340. yunshuguanli
  341. </div>
  342. <div class="code-name">.icon-yunshu2
  343. </div>
  344. </li>
  345. <li class="dib">
  346. <span class="icon iconfont icon-hetongguanli"></span>
  347. <div class="name">
  348. hetong
  349. </div>
  350. <div class="code-name">.icon-hetongguanli
  351. </div>
  352. </li>
  353. <li class="dib">
  354. <span class="icon iconfont icon-index-copy"></span>
  355. <div class="name">
  356. index
  357. </div>
  358. <div class="code-name">.icon-index-copy
  359. </div>
  360. </li>
  361. <li class="dib">
  362. <span class="icon iconfont icon-shouqi"></span>
  363. <div class="name">
  364. shouqi
  365. </div>
  366. <div class="code-name">.icon-shouqi
  367. </div>
  368. </li>
  369. <li class="dib">
  370. <span class="icon iconfont icon-zhankai"></span>
  371. <div class="name">
  372. zhankai
  373. </div>
  374. <div class="code-name">.icon-zhankai
  375. </div>
  376. </li>
  377. <li class="dib">
  378. <span class="icon iconfont icon-cangkubeifen"></span>
  379. <div class="name">
  380. cangku
  381. </div>
  382. <div class="code-name">.icon-cangkubeifen
  383. </div>
  384. </li>
  385. <li class="dib">
  386. <span class="icon iconfont icon-renwuguanli"></span>
  387. <div class="name">
  388. renwuguanli
  389. </div>
  390. <div class="code-name">.icon-renwuguanli
  391. </div>
  392. </li>
  393. </ul>
  394. <div class="article markdown">
  395. <h2 id="font-class-">font-class 引用</h2>
  396. <hr>
  397. <p>font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
  398. <p>与 Unicode 使用方式相比,具有如下特点:</p>
  399. <ul>
  400. <li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
  401. <li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
  402. </ul>
  403. <p>使用步骤如下:</p>
  404. <h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
  405. <pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
  406. </code></pre>
  407. <h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
  408. <pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
  409. </code></pre>
  410. <blockquote>
  411. <p>"
  412. iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
  413. </blockquote>
  414. </div>
  415. </div>
  416. <div class="content symbol">
  417. <ul class="icon_lists dib-box">
  418. <li class="dib">
  419. <svg class="icon svg-icon" aria-hidden="true">
  420. <use xlink:href="#icon-kehuzijin"></use>
  421. </svg>
  422. <div class="name">kehuzijin</div>
  423. <div class="code-name">#icon-kehuzijin</div>
  424. </li>
  425. <li class="dib">
  426. <svg class="icon svg-icon" aria-hidden="true">
  427. <use xlink:href="#icon-a-4-shougoubeifen"></use>
  428. </svg>
  429. <div class="name">shougou</div>
  430. <div class="code-name">#icon-a-4-shougoubeifen</div>
  431. </li>
  432. <li class="dib">
  433. <svg class="icon svg-icon" aria-hidden="true">
  434. <use xlink:href="#icon-chukuguanlibeifen"></use>
  435. </svg>
  436. <div class="name">chukuguanli备份</div>
  437. <div class="code-name">#icon-chukuguanlibeifen</div>
  438. </li>
  439. <li class="dib">
  440. <svg class="icon svg-icon" aria-hidden="true">
  441. <use xlink:href="#icon-a-tongzhibeifen2"></use>
  442. </svg>
  443. <div class="name">gongzuotongzi</div>
  444. <div class="code-name">#icon-a-tongzhibeifen2</div>
  445. </li>
  446. <li class="dib">
  447. <svg class="icon svg-icon" aria-hidden="true">
  448. <use xlink:href="#icon-kehuguanli"></use>
  449. </svg>
  450. <div class="name">kehuguanli</div>
  451. <div class="code-name">#icon-kehuguanli</div>
  452. </li>
  453. <li class="dib">
  454. <svg class="icon svg-icon" aria-hidden="true">
  455. <use xlink:href="#icon-caiwuguanli"></use>
  456. </svg>
  457. <div class="name">caiwuguanli</div>
  458. <div class="code-name">#icon-caiwuguanli</div>
  459. </li>
  460. <li class="dib">
  461. <svg class="icon svg-icon" aria-hidden="true">
  462. <use xlink:href="#icon-shenhe"></use>
  463. </svg>
  464. <div class="name">shenhe</div>
  465. <div class="code-name">#icon-shenhe</div>
  466. </li>
  467. <li class="dib">
  468. <svg class="icon svg-icon" aria-hidden="true">
  469. <use xlink:href="#icon-caigouguanli"></use>
  470. </svg>
  471. <div class="name">caigouguanli</div>
  472. <div class="code-name">#icon-caigouguanli</div>
  473. </li>
  474. <li class="dib">
  475. <svg class="icon svg-icon" aria-hidden="true">
  476. <use xlink:href="#icon-xiaoshou2"></use>
  477. </svg>
  478. <div class="name">xiaoshou2</div>
  479. <div class="code-name">#icon-xiaoshou2</div>
  480. </li>
  481. <li class="dib">
  482. <svg class="icon svg-icon" aria-hidden="true">
  483. <use xlink:href="#icon-tongjibaobiao"></use>
  484. </svg>
  485. <div class="name">tongjibaobiao</div>
  486. <div class="code-name">#icon-tongjibaobiao</div>
  487. </li>
  488. <li class="dib">
  489. <svg class="icon svg-icon" aria-hidden="true">
  490. <use xlink:href="#icon-dui"></use>
  491. </svg>
  492. <div class="name">对</div>
  493. <div class="code-name">#icon-dui</div>
  494. </li>
  495. <li class="dib">
  496. <svg class="icon svg-icon" aria-hidden="true">
  497. <use xlink:href="#icon-yiliangyiyun"></use>
  498. </svg>
  499. <div class="name">招粮云仓</div>
  500. <div class="code-name">#icon-yiliangyiyun</div>
  501. </li>
  502. <li class="dib">
  503. <svg class="icon svg-icon" aria-hidden="true">
  504. <use xlink:href="#icon-lishi"></use>
  505. </svg>
  506. <div class="name">历史</div>
  507. <div class="code-name">#icon-lishi</div>
  508. </li>
  509. <li class="dib">
  510. <svg class="icon svg-icon" aria-hidden="true">
  511. <use xlink:href="#icon-guanbi"></use>
  512. </svg>
  513. <div class="name">关 闭</div>
  514. <div class="code-name">#icon-guanbi</div>
  515. </li>
  516. <li class="dib">
  517. <svg class="icon svg-icon" aria-hidden="true">
  518. <use xlink:href="#icon-yanjing-zhengyan"></use>
  519. </svg>
  520. <div class="name">眼睛-睁眼</div>
  521. <div class="code-name">#icon-yanjing-zhengyan</div>
  522. </li>
  523. <li class="dib">
  524. <svg class="icon svg-icon" aria-hidden="true">
  525. <use xlink:href="#icon-yanjing-biyan"></use>
  526. </svg>
  527. <div class="name">眼睛-闭眼</div>
  528. <div class="code-name">#icon-yanjing-biyan</div>
  529. </li>
  530. <li class="dib">
  531. <svg class="icon svg-icon" aria-hidden="true">
  532. <use xlink:href="#icon-yunshu2"></use>
  533. </svg>
  534. <div class="name">yunshuguanli</div>
  535. <div class="code-name">#icon-yunshu2</div>
  536. </li>
  537. <li class="dib">
  538. <svg class="icon svg-icon" aria-hidden="true">
  539. <use xlink:href="#icon-hetongguanli"></use>
  540. </svg>
  541. <div class="name">hetong</div>
  542. <div class="code-name">#icon-hetongguanli</div>
  543. </li>
  544. <li class="dib">
  545. <svg class="icon svg-icon" aria-hidden="true">
  546. <use xlink:href="#icon-index-copy"></use>
  547. </svg>
  548. <div class="name">index</div>
  549. <div class="code-name">#icon-index-copy</div>
  550. </li>
  551. <li class="dib">
  552. <svg class="icon svg-icon" aria-hidden="true">
  553. <use xlink:href="#icon-shouqi"></use>
  554. </svg>
  555. <div class="name">shouqi</div>
  556. <div class="code-name">#icon-shouqi</div>
  557. </li>
  558. <li class="dib">
  559. <svg class="icon svg-icon" aria-hidden="true">
  560. <use xlink:href="#icon-zhankai"></use>
  561. </svg>
  562. <div class="name">zhankai</div>
  563. <div class="code-name">#icon-zhankai</div>
  564. </li>
  565. <li class="dib">
  566. <svg class="icon svg-icon" aria-hidden="true">
  567. <use xlink:href="#icon-cangkubeifen"></use>
  568. </svg>
  569. <div class="name">cangku</div>
  570. <div class="code-name">#icon-cangkubeifen</div>
  571. </li>
  572. <li class="dib">
  573. <svg class="icon svg-icon" aria-hidden="true">
  574. <use xlink:href="#icon-renwuguanli"></use>
  575. </svg>
  576. <div class="name">renwuguanli</div>
  577. <div class="code-name">#icon-renwuguanli</div>
  578. </li>
  579. </ul>
  580. <div class="article markdown">
  581. <h2 id="symbol-">Symbol 引用</h2>
  582. <hr>
  583. <p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
  584. 这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
  585. <ul>
  586. <li>支持多色图标了,不再受单色限制。</li>
  587. <li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
  588. <li>兼容性较差,支持 IE9+,及现代浏览器。</li>
  589. <li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
  590. </ul>
  591. <p>使用步骤如下:</p>
  592. <h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
  593. <pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
  594. </code></pre>
  595. <h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
  596. <pre><code class="language-html">&lt;style&gt;
  597. .icon {
  598. width: 1em;
  599. height: 1em;
  600. vertical-align: -0.15em;
  601. fill: currentColor;
  602. overflow: hidden;
  603. }
  604. &lt;/style&gt;
  605. </code></pre>
  606. <h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
  607. <pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
  608. &lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
  609. &lt;/svg&gt;
  610. </code></pre>
  611. </div>
  612. </div>
  613. </div>
  614. </div>
  615. <script>
  616. $(document).ready(function () {
  617. $('.tab-container .content:first').show()
  618. $('#tabs li').click(function (e) {
  619. var tabContent = $('.tab-container .content')
  620. var index = $(this).index()
  621. if ($(this).hasClass('active')) {
  622. return
  623. } else {
  624. $('#tabs li').removeClass('active')
  625. $(this).addClass('active')
  626. tabContent.hide().eq(index).fadeIn()
  627. }
  628. })
  629. })
  630. </script>
  631. </body>
  632. </html>