demo_symbol.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8"/>
  5. <title>IconFont</title>
  6. <link rel="stylesheet" href="demo.css">
  7. <script src="iconfont.js"></script>
  8. <style type="text/css">
  9. .icon {
  10. /* 通过设置 font-size 来改变图标大小 */
  11. width: 1em; height: 1em;
  12. /* 图标和文字相邻时,垂直对齐 */
  13. vertical-align: -0.15em;
  14. /* 通过设置 color 来改变 SVG 的颜色/fill */
  15. fill: currentColor;
  16. /* path 和 stroke 溢出 viewBox 部分在 IE 下会显示
  17. normalize.css 中也包含这行 */
  18. overflow: hidden;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <div class="main markdown">
  24. <h1>IconFont 图标</h1>
  25. <ul class="icon_lists clear">
  26. <li>
  27. <svg class="icon" aria-hidden="true">
  28. <use xlink:href="#icon-tuan"></use>
  29. </svg>
  30. <div class="name">团</div>
  31. <div class="fontclass">#icon-tuan</div>
  32. </li>
  33. <li>
  34. <svg class="icon" aria-hidden="true">
  35. <use xlink:href="#icon-kafei"></use>
  36. </svg>
  37. <div class="name">咖啡</div>
  38. <div class="fontclass">#icon-kafei</div>
  39. </li>
  40. <li>
  41. <svg class="icon" aria-hidden="true">
  42. <use xlink:href="#icon-shequ"></use>
  43. </svg>
  44. <div class="name">社区</div>
  45. <div class="fontclass">#icon-shequ</div>
  46. </li>
  47. <li>
  48. <svg class="icon" aria-hidden="true">
  49. <use xlink:href="#icon-xiazai"></use>
  50. </svg>
  51. <div class="name">下载</div>
  52. <div class="fontclass">#icon-xiazai</div>
  53. </li>
  54. <li>
  55. <svg class="icon" aria-hidden="true">
  56. <use xlink:href="#icon-android"></use>
  57. </svg>
  58. <div class="name">android</div>
  59. <div class="fontclass">#icon-android</div>
  60. </li>
  61. <li>
  62. <svg class="icon" aria-hidden="true">
  63. <use xlink:href="#icon-shouji"></use>
  64. </svg>
  65. <div class="name">手机</div>
  66. <div class="fontclass">#icon-shouji</div>
  67. </li>
  68. <li>
  69. <svg class="icon" aria-hidden="true">
  70. <use xlink:href="#icon-dianhua"></use>
  71. </svg>
  72. <div class="name">电话</div>
  73. <div class="fontclass">#icon-dianhua</div>
  74. </li>
  75. <li>
  76. <svg class="icon" aria-hidden="true">
  77. <use xlink:href="#icon-dianhua2"></use>
  78. </svg>
  79. <div class="name">电话</div>
  80. <div class="fontclass">#icon-dianhua2</div>
  81. </li>
  82. <li>
  83. <svg class="icon" aria-hidden="true">
  84. <use xlink:href="#icon-kefu2"></use>
  85. </svg>
  86. <div class="name">客服</div>
  87. <div class="fontclass">#icon-kefu2</div>
  88. </li>
  89. <li>
  90. <svg class="icon" aria-hidden="true">
  91. <use xlink:href="#icon-xin"></use>
  92. </svg>
  93. <div class="name">心</div>
  94. <div class="fontclass">#icon-xin</div>
  95. </li>
  96. <li>
  97. <svg class="icon" aria-hidden="true">
  98. <use xlink:href="#icon-yaoqing"></use>
  99. </svg>
  100. <div class="name">邀请</div>
  101. <div class="fontclass">#icon-yaoqing</div>
  102. </li>
  103. <li>
  104. <svg class="icon" aria-hidden="true">
  105. <use xlink:href="#icon-goutong"></use>
  106. </svg>
  107. <div class="name">沟通</div>
  108. <div class="fontclass">#icon-goutong</div>
  109. </li>
  110. <li>
  111. <svg class="icon" aria-hidden="true">
  112. <use xlink:href="#icon-shubiao"></use>
  113. </svg>
  114. <div class="name">鼠标</div>
  115. <div class="fontclass">#icon-shubiao</div>
  116. </li>
  117. <li>
  118. <svg class="icon" aria-hidden="true">
  119. <use xlink:href="#icon-73316"></use>
  120. </svg>
  121. <div class="name">医疗</div>
  122. <div class="fontclass">#icon-73316</div>
  123. </li>
  124. <li>
  125. <svg class="icon" aria-hidden="true">
  126. <use xlink:href="#icon-yumingjiexi"></use>
  127. </svg>
  128. <div class="name">域名解析</div>
  129. <div class="fontclass">#icon-yumingjiexi</div>
  130. </li>
  131. <li>
  132. <svg class="icon" aria-hidden="true">
  133. <use xlink:href="#icon-xuchaobiaoqian"></use>
  134. </svg>
  135. <div class="name">别针</div>
  136. <div class="fontclass">#icon-xuchaobiaoqian</div>
  137. </li>
  138. <li>
  139. <svg class="icon" aria-hidden="true">
  140. <use xlink:href="#icon-mjiantou"></use>
  141. </svg>
  142. <div class="name">右箭头</div>
  143. <div class="fontclass">#icon-mjiantou</div>
  144. </li>
  145. <li>
  146. <svg class="icon" aria-hidden="true">
  147. <use xlink:href="#icon-app"></use>
  148. </svg>
  149. <div class="name">app</div>
  150. <div class="fontclass">#icon-app</div>
  151. </li>
  152. <li>
  153. <svg class="icon" aria-hidden="true">
  154. <use xlink:href="#icon-canyin"></use>
  155. </svg>
  156. <div class="name">餐饮</div>
  157. <div class="fontclass">#icon-canyin</div>
  158. </li>
  159. <li>
  160. <svg class="icon" aria-hidden="true">
  161. <use xlink:href="#icon-svgiconyouxi"></use>
  162. </svg>
  163. <div class="name">眼睛</div>
  164. <div class="fontclass">#icon-svgiconyouxi</div>
  165. </li>
  166. <li>
  167. <svg class="icon" aria-hidden="true">
  168. <use xlink:href="#icon-ios"></use>
  169. </svg>
  170. <div class="name">ios</div>
  171. <div class="fontclass">#icon-ios</div>
  172. </li>
  173. <li>
  174. <svg class="icon" aria-hidden="true">
  175. <use xlink:href="#icon-kaifa"></use>
  176. </svg>
  177. <div class="name">开发</div>
  178. <div class="fontclass">#icon-kaifa</div>
  179. </li>
  180. <li>
  181. <svg class="icon" aria-hidden="true">
  182. <use xlink:href="#icon-weixin"></use>
  183. </svg>
  184. <div class="name">微信</div>
  185. <div class="fontclass">#icon-weixin</div>
  186. </li>
  187. <li>
  188. <svg class="icon" aria-hidden="true">
  189. <use xlink:href="#icon-huojian"></use>
  190. </svg>
  191. <div class="name">1火箭</div>
  192. <div class="fontclass">#icon-huojian</div>
  193. </li>
  194. <li>
  195. <svg class="icon" aria-hidden="true">
  196. <use xlink:href="#icon-service"></use>
  197. </svg>
  198. <div class="name">服务</div>
  199. <div class="fontclass">#icon-service</div>
  200. </li>
  201. <li>
  202. <svg class="icon" aria-hidden="true">
  203. <use xlink:href="#icon-kaiqihuodong"></use>
  204. </svg>
  205. <div class="name">开启活动</div>
  206. <div class="fontclass">#icon-kaiqihuodong</div>
  207. </li>
  208. <li>
  209. <svg class="icon" aria-hidden="true">
  210. <use xlink:href="#icon-diannao1"></use>
  211. </svg>
  212. <div class="name">电脑</div>
  213. <div class="fontclass">#icon-diannao1</div>
  214. </li>
  215. <li>
  216. <svg class="icon" aria-hidden="true">
  217. <use xlink:href="#icon-o2o"></use>
  218. </svg>
  219. <div class="name">O2O</div>
  220. <div class="fontclass">#icon-o2o</div>
  221. </li>
  222. <li>
  223. <svg class="icon" aria-hidden="true">
  224. <use xlink:href="#icon-kaxinxi"></use>
  225. </svg>
  226. <div class="name">会员卡</div>
  227. <div class="fontclass">#icon-kaxinxi</div>
  228. </li>
  229. <li>
  230. <svg class="icon" aria-hidden="true">
  231. <use xlink:href="#icon-qiuhuixuanzhong"></use>
  232. </svg>
  233. <div class="name">球会选中</div>
  234. <div class="fontclass">#icon-qiuhuixuanzhong</div>
  235. </li>
  236. <li>
  237. <svg class="icon" aria-hidden="true">
  238. <use xlink:href="#icon-xianshang"></use>
  239. </svg>
  240. <div class="name">线上</div>
  241. <div class="fontclass">#icon-xianshang</div>
  242. </li>
  243. <li>
  244. <svg class="icon" aria-hidden="true">
  245. <use xlink:href="#icon-wifi"></use>
  246. </svg>
  247. <div class="name">wifi</div>
  248. <div class="fontclass">#icon-wifi</div>
  249. </li>
  250. <li>
  251. <svg class="icon" aria-hidden="true">
  252. <use xlink:href="#icon-lvyou"></use>
  253. </svg>
  254. <div class="name">旅游</div>
  255. <div class="fontclass">#icon-lvyou</div>
  256. </li>
  257. <li>
  258. <svg class="icon" aria-hidden="true">
  259. <use xlink:href="#icon-qq"></use>
  260. </svg>
  261. <div class="name">qq</div>
  262. <div class="fontclass">#icon-qq</div>
  263. </li>
  264. <li>
  265. <svg class="icon" aria-hidden="true">
  266. <use xlink:href="#icon-kefu1"></use>
  267. </svg>
  268. <div class="name">客服</div>
  269. <div class="fontclass">#icon-kefu1</div>
  270. </li>
  271. <li>
  272. <svg class="icon" aria-hidden="true">
  273. <use xlink:href="#icon-weihu"></use>
  274. </svg>
  275. <div class="name">维护</div>
  276. <div class="fontclass">#icon-weihu</div>
  277. </li>
  278. <li>
  279. <svg class="icon" aria-hidden="true">
  280. <use xlink:href="#icon-fene"></use>
  281. </svg>
  282. <div class="name">买入份额</div>
  283. <div class="fontclass">#icon-fene</div>
  284. </li>
  285. <li>
  286. <svg class="icon" aria-hidden="true">
  287. <use xlink:href="#icon-top"></use>
  288. </svg>
  289. <div class="name">返回顶部</div>
  290. <div class="fontclass">#icon-top</div>
  291. </li>
  292. <li>
  293. <svg class="icon" aria-hidden="true">
  294. <use xlink:href="#icon-xitong"></use>
  295. </svg>
  296. <div class="name">系统</div>
  297. <div class="fontclass">#icon-xitong</div>
  298. </li>
  299. <li>
  300. <svg class="icon" aria-hidden="true">
  301. <use xlink:href="#icon-menu"></use>
  302. </svg>
  303. <div class="name">菜单</div>
  304. <div class="fontclass">#icon-menu</div>
  305. </li>
  306. <li>
  307. <svg class="icon" aria-hidden="true">
  308. <use xlink:href="#icon-jianrongxing"></use>
  309. </svg>
  310. <div class="name">兼容性</div>
  311. <div class="fontclass">#icon-jianrongxing</div>
  312. </li>
  313. <li>
  314. <svg class="icon" aria-hidden="true">
  315. <use xlink:href="#icon-gengduo"></use>
  316. </svg>
  317. <div class="name">更多</div>
  318. <div class="fontclass">#icon-gengduo</div>
  319. </li>
  320. <li>
  321. <svg class="icon" aria-hidden="true">
  322. <use xlink:href="#icon-ui"></use>
  323. </svg>
  324. <div class="name">UI</div>
  325. <div class="fontclass">#icon-ui</div>
  326. </li>
  327. <li>
  328. <svg class="icon" aria-hidden="true">
  329. <use xlink:href="#icon-jhyxsj"></use>
  330. </svg>
  331. <div class="name">交互原型设计</div>
  332. <div class="fontclass">#icon-jhyxsj</div>
  333. </li>
  334. <li>
  335. <svg class="icon" aria-hidden="true">
  336. <use xlink:href="#icon-kefu"></use>
  337. </svg>
  338. <div class="name">客服</div>
  339. <div class="fontclass">#icon-kefu</div>
  340. </li>
  341. <li>
  342. <svg class="icon" aria-hidden="true">
  343. <use xlink:href="#icon-shangcheng"></use>
  344. </svg>
  345. <div class="name">商城</div>
  346. <div class="fontclass">#icon-shangcheng</div>
  347. </li>
  348. <li>
  349. <svg class="icon" aria-hidden="true">
  350. <use xlink:href="#icon-cuo"></use>
  351. </svg>
  352. <div class="name">错</div>
  353. <div class="fontclass">#icon-cuo</div>
  354. </li>
  355. <li>
  356. <svg class="icon" aria-hidden="true">
  357. <use xlink:href="#icon-taideng"></use>
  358. </svg>
  359. <div class="name">台灯</div>
  360. <div class="fontclass">#icon-taideng</div>
  361. </li>
  362. <li>
  363. <svg class="icon" aria-hidden="true">
  364. <use xlink:href="#icon-zhenghe"></use>
  365. </svg>
  366. <div class="name">iconfont整合-29</div>
  367. <div class="fontclass">#icon-zhenghe</div>
  368. </li>
  369. <li>
  370. <svg class="icon" aria-hidden="true">
  371. <use xlink:href="#icon-peixun"></use>
  372. </svg>
  373. <div class="name">培训 (1)</div>
  374. <div class="fontclass">#icon-peixun</div>
  375. </li>
  376. <li>
  377. <svg class="icon" aria-hidden="true">
  378. <use xlink:href="#icon-shangchuan"></use>
  379. </svg>
  380. <div class="name">上传</div>
  381. <div class="fontclass">#icon-shangchuan</div>
  382. </li>
  383. <li>
  384. <svg class="icon" aria-hidden="true">
  385. <use xlink:href="#icon-liaotian"></use>
  386. </svg>
  387. <div class="name">聊天</div>
  388. <div class="fontclass">#icon-liaotian</div>
  389. </li>
  390. <li>
  391. <svg class="icon" aria-hidden="true">
  392. <use xlink:href="#icon-xiangce"></use>
  393. </svg>
  394. <div class="name">相册</div>
  395. <div class="fontclass">#icon-xiangce</div>
  396. </li>
  397. <li>
  398. <svg class="icon" aria-hidden="true">
  399. <use xlink:href="#icon-xiangji"></use>
  400. </svg>
  401. <div class="name">相机</div>
  402. <div class="fontclass">#icon-xiangji</div>
  403. </li>
  404. <li>
  405. <svg class="icon" aria-hidden="true">
  406. <use xlink:href="#icon-shijuesheji"></use>
  407. </svg>
  408. <div class="name">视觉设计</div>
  409. <div class="fontclass">#icon-shijuesheji</div>
  410. </li>
  411. <li>
  412. <svg class="icon" aria-hidden="true">
  413. <use xlink:href="#icon-liucheng"></use>
  414. </svg>
  415. <div class="name">流程</div>
  416. <div class="fontclass">#icon-liucheng</div>
  417. </li>
  418. <li>
  419. <svg class="icon" aria-hidden="true">
  420. <use xlink:href="#icon-pintu"></use>
  421. </svg>
  422. <div class="name">拼图</div>
  423. <div class="fontclass">#icon-pintu</div>
  424. </li>
  425. <li>
  426. <svg class="icon" aria-hidden="true">
  427. <use xlink:href="#icon-xiazai1"></use>
  428. </svg>
  429. <div class="name">下载</div>
  430. <div class="fontclass">#icon-xiazai1</div>
  431. </li>
  432. <li>
  433. <svg class="icon" aria-hidden="true">
  434. <use xlink:href="#icon-shuju"></use>
  435. </svg>
  436. <div class="name">数据</div>
  437. <div class="fontclass">#icon-shuju</div>
  438. </li>
  439. <li>
  440. <svg class="icon" aria-hidden="true">
  441. <use xlink:href="#icon-sheji"></use>
  442. </svg>
  443. <div class="name">设计</div>
  444. <div class="fontclass">#icon-sheji</div>
  445. </li>
  446. <li>
  447. <svg class="icon" aria-hidden="true">
  448. <use xlink:href="#icon-yingxiaoxinxi"></use>
  449. </svg>
  450. <div class="name">营销信息</div>
  451. <div class="fontclass">#icon-yingxiaoxinxi</div>
  452. </li>
  453. <li>
  454. <svg class="icon" aria-hidden="true">
  455. <use xlink:href="#icon-qiche"></use>
  456. </svg>
  457. <div class="name">汽车</div>
  458. <div class="fontclass">#icon-qiche</div>
  459. </li>
  460. <li>
  461. <svg class="icon" aria-hidden="true">
  462. <use xlink:href="#icon-huizhang"></use>
  463. </svg>
  464. <div class="name">徽章</div>
  465. <div class="fontclass">#icon-huizhang</div>
  466. </li>
  467. <li>
  468. <svg class="icon" aria-hidden="true">
  469. <use xlink:href="#icon-huaban"></use>
  470. </svg>
  471. <div class="name">工具</div>
  472. <div class="fontclass">#icon-huaban</div>
  473. </li>
  474. <li>
  475. <svg class="icon" aria-hidden="true">
  476. <use xlink:href="#icon-xiangyouyo"></use>
  477. </svg>
  478. <div class="name">向右</div>
  479. <div class="fontclass">#icon-xiangyouyo</div>
  480. </li>
  481. <li>
  482. <svg class="icon" aria-hidden="true">
  483. <use xlink:href="#icon-shezhi"></use>
  484. </svg>
  485. <div class="name">设置</div>
  486. <div class="fontclass">#icon-shezhi</div>
  487. </li>
  488. <li>
  489. <svg class="icon" aria-hidden="true">
  490. <use xlink:href="#icon-dianhua1"></use>
  491. </svg>
  492. <div class="name">电话</div>
  493. <div class="fontclass">#icon-dianhua1</div>
  494. </li>
  495. <li>
  496. <svg class="icon" aria-hidden="true">
  497. <use xlink:href="#icon-yinhangqia"></use>
  498. </svg>
  499. <div class="name">银行卡</div>
  500. <div class="fontclass">#icon-yinhangqia</div>
  501. </li>
  502. <li>
  503. <svg class="icon" aria-hidden="true">
  504. <use xlink:href="#icon-diannao"></use>
  505. </svg>
  506. <div class="name">电脑</div>
  507. <div class="fontclass">#icon-diannao</div>
  508. </li>
  509. <li>
  510. <svg class="icon" aria-hidden="true">
  511. <use xlink:href="#icon-dianshang"></use>
  512. </svg>
  513. <div class="name">电商</div>
  514. <div class="fontclass">#icon-dianshang</div>
  515. </li>
  516. <li>
  517. <svg class="icon" aria-hidden="true">
  518. <use xlink:href="#icon-jinrong"></use>
  519. </svg>
  520. <div class="name">金融</div>
  521. <div class="fontclass">#icon-jinrong</div>
  522. </li>
  523. <li>
  524. <svg class="icon" aria-hidden="true">
  525. <use xlink:href="#icon-ziyuan"></use>
  526. </svg>
  527. <div class="name">合同</div>
  528. <div class="fontclass">#icon-ziyuan</div>
  529. </li>
  530. <li>
  531. <svg class="icon" aria-hidden="true">
  532. <use xlink:href="#icon-yanshou"></use>
  533. </svg>
  534. <div class="name">6收货验收</div>
  535. <div class="fontclass">#icon-yanshou</div>
  536. </li>
  537. <li>
  538. <svg class="icon" aria-hidden="true">
  539. <use xlink:href="#icon-yingyee"></use>
  540. </svg>
  541. <div class="name">累计营业额</div>
  542. <div class="fontclass">#icon-yingyee</div>
  543. </li>
  544. <li>
  545. <svg class="icon" aria-hidden="true">
  546. <use xlink:href="#icon-weixin1"></use>
  547. </svg>
  548. <div class="name">微信</div>
  549. <div class="fontclass">#icon-weixin1</div>
  550. </li>
  551. </ul>
  552. <h2 id="symbol-">symbol引用</h2>
  553. <hr>
  554. <p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
  555. 这种用法其实是做了一个svg的集合,与另外两种相比具有如下特点:</p>
  556. <ul>
  557. <li>支持多色图标了,不再受单色限制。</li>
  558. <li>通过一些技巧,支持像字体那样,通过<code>font-size</code>,<code>color</code>来调整样式。</li>
  559. <li>兼容性较差,支持 ie9+,及现代浏览器。</li>
  560. <li>浏览器渲染svg的性能一般,还不如png。</li>
  561. </ul>
  562. <p>使用步骤如下:</p>
  563. <h3 id="-symbol-">第一步:引入项目下面生成的symbol代码:</h3>
  564. <pre><code class="lang-js hljs javascript"><span class="hljs-comment">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;</span></code></pre>
  565. <h3 id="-css-">第二步:加入通用css代码(引入一次就行):</h3>
  566. <pre><code class="lang-js hljs javascript">&lt;style type=<span class="hljs-string">"text/css"</span>&gt;
  567. .icon {
  568. width: <span class="hljs-number">1</span>em; height: <span class="hljs-number">1</span>em;
  569. vertical-align: <span class="hljs-number">-0.15</span>em;
  570. fill: currentColor;
  571. overflow: hidden;
  572. }
  573. &lt;<span class="hljs-regexp">/style&gt;</span></code></pre>
  574. <h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
  575. <pre><code class="lang-js hljs javascript">&lt;svg <span class="hljs-class"><span class="hljs-keyword">class</span></span>=<span class="hljs-string">"icon"</span> aria-hidden=<span class="hljs-string">"true"</span>&gt;<span class="xml"><span class="hljs-tag">
  576. &lt;<span class="hljs-name">use</span> <span class="hljs-attr">xlink:href</span>=<span class="hljs-string">"#icon-xxx"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">use</span>&gt;</span>
  577. </span>&lt;<span class="hljs-regexp">/svg&gt;
  578. </span></code></pre>
  579. </div>
  580. </body>
  581. </html>