demo_symbol.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600
  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="#dsit-weixiubaoyang"></use>
  29. </svg>
  30. <div class="name">维修保养</div>
  31. <div class="fontclass">#dsit-weixiubaoyang</div>
  32. </li>
  33. <li>
  34. <svg class="icon" aria-hidden="true">
  35. <use xlink:href="#dsit-gonggao"></use>
  36. </svg>
  37. <div class="name">公告</div>
  38. <div class="fontclass">#dsit-gonggao</div>
  39. </li>
  40. <li>
  41. <svg class="icon" aria-hidden="true">
  42. <use xlink:href="#dsit-liebiao1"></use>
  43. </svg>
  44. <div class="name">列表</div>
  45. <div class="fontclass">#dsit-liebiao1</div>
  46. </li>
  47. <li>
  48. <svg class="icon" aria-hidden="true">
  49. <use xlink:href="#dsit-woyaobaoxiu"></use>
  50. </svg>
  51. <div class="name">我要报修</div>
  52. <div class="fontclass">#dsit-woyaobaoxiu</div>
  53. </li>
  54. <li>
  55. <svg class="icon" aria-hidden="true">
  56. <use xlink:href="#dsit-gonggao1"></use>
  57. </svg>
  58. <div class="name">公告</div>
  59. <div class="fontclass">#dsit-gonggao1</div>
  60. </li>
  61. <li>
  62. <svg class="icon" aria-hidden="true">
  63. <use xlink:href="#dsit-question"></use>
  64. </svg>
  65. <div class="name">问题</div>
  66. <div class="fontclass">#dsit-question</div>
  67. </li>
  68. <li>
  69. <svg class="icon" aria-hidden="true">
  70. <use xlink:href="#dsit-tianjia"></use>
  71. </svg>
  72. <div class="name">添加</div>
  73. <div class="fontclass">#dsit-tianjia</div>
  74. </li>
  75. <li>
  76. <svg class="icon" aria-hidden="true">
  77. <use xlink:href="#dsit-xinjian"></use>
  78. </svg>
  79. <div class="name">新建</div>
  80. <div class="fontclass">#dsit-xinjian</div>
  81. </li>
  82. <li>
  83. <svg class="icon" aria-hidden="true">
  84. <use xlink:href="#dsit-xiangzuo"></use>
  85. </svg>
  86. <div class="name">向左</div>
  87. <div class="fontclass">#dsit-xiangzuo</div>
  88. </li>
  89. <li>
  90. <svg class="icon" aria-hidden="true">
  91. <use xlink:href="#dsit-zhuti"></use>
  92. </svg>
  93. <div class="name">主题</div>
  94. <div class="fontclass">#dsit-zhuti</div>
  95. </li>
  96. <li>
  97. <svg class="icon" aria-hidden="true">
  98. <use xlink:href="#dsit-shouye"></use>
  99. </svg>
  100. <div class="name">首页</div>
  101. <div class="fontclass">#dsit-shouye</div>
  102. </li>
  103. <li>
  104. <svg class="icon" aria-hidden="true">
  105. <use xlink:href="#dsit-false-circle"></use>
  106. </svg>
  107. <div class="name">错</div>
  108. <div class="fontclass">#dsit-false-circle</div>
  109. </li>
  110. <li>
  111. <svg class="icon" aria-hidden="true">
  112. <use xlink:href="#dsit-wode"></use>
  113. </svg>
  114. <div class="name">我的</div>
  115. <div class="fontclass">#dsit-wode</div>
  116. </li>
  117. <li>
  118. <svg class="icon" aria-hidden="true">
  119. <use xlink:href="#dsit-gengduo"></use>
  120. </svg>
  121. <div class="name">更多</div>
  122. <div class="fontclass">#dsit-gengduo</div>
  123. </li>
  124. <li>
  125. <svg class="icon" aria-hidden="true">
  126. <use xlink:href="#dsit-icon-text-newlybuild"></use>
  127. </svg>
  128. <div class="name">新建</div>
  129. <div class="fontclass">#dsit-icon-text-newlybuild</div>
  130. </li>
  131. <li>
  132. <svg class="icon" aria-hidden="true">
  133. <use xlink:href="#dsit-baoxiushenqing"></use>
  134. </svg>
  135. <div class="name">保修申请</div>
  136. <div class="fontclass">#dsit-baoxiushenqing</div>
  137. </li>
  138. <li>
  139. <svg class="icon" aria-hidden="true">
  140. <use xlink:href="#dsit-xunjian"></use>
  141. </svg>
  142. <div class="name">巡检</div>
  143. <div class="fontclass">#dsit-xunjian</div>
  144. </li>
  145. <li>
  146. <svg class="icon" aria-hidden="true">
  147. <use xlink:href="#dsit-daishouli"></use>
  148. </svg>
  149. <div class="name">待受理3</div>
  150. <div class="fontclass">#dsit-daishouli</div>
  151. </li>
  152. <li>
  153. <svg class="icon" aria-hidden="true">
  154. <use xlink:href="#dsit-shoulizhong"></use>
  155. </svg>
  156. <div class="name">受理中1</div>
  157. <div class="fontclass">#dsit-shoulizhong</div>
  158. </li>
  159. <li>
  160. <svg class="icon" aria-hidden="true">
  161. <use xlink:href="#dsit-shouliwancheng"></use>
  162. </svg>
  163. <div class="name">受理完成</div>
  164. <div class="fontclass">#dsit-shouliwancheng</div>
  165. </li>
  166. <li>
  167. <svg class="icon" aria-hidden="true">
  168. <use xlink:href="#dsit-chakan"></use>
  169. </svg>
  170. <div class="name">查看</div>
  171. <div class="fontclass">#dsit-chakan</div>
  172. </li>
  173. <li>
  174. <svg class="icon" aria-hidden="true">
  175. <use xlink:href="#dsit-shenhe"></use>
  176. </svg>
  177. <div class="name">审核</div>
  178. <div class="fontclass">#dsit-shenhe</div>
  179. </li>
  180. <li>
  181. <svg class="icon" aria-hidden="true">
  182. <use xlink:href="#dsit-bianji1"></use>
  183. </svg>
  184. <div class="name">编辑</div>
  185. <div class="fontclass">#dsit-bianji1</div>
  186. </li>
  187. <li>
  188. <svg class="icon" aria-hidden="true">
  189. <use xlink:href="#dsit-daiwochulide"></use>
  190. </svg>
  191. <div class="name">待我处理的-工单</div>
  192. <div class="fontclass">#dsit-daiwochulide</div>
  193. </li>
  194. <li>
  195. <svg class="icon" aria-hidden="true">
  196. <use xlink:href="#dsit-shebeixunjian"></use>
  197. </svg>
  198. <div class="name">设备巡检</div>
  199. <div class="fontclass">#dsit-shebeixunjian</div>
  200. </li>
  201. <li>
  202. <svg class="icon" aria-hidden="true">
  203. <use xlink:href="#dsit-xinjiangongdan"></use>
  204. </svg>
  205. <div class="name">新建工单</div>
  206. <div class="fontclass">#dsit-xinjiangongdan</div>
  207. </li>
  208. <li>
  209. <svg class="icon" aria-hidden="true">
  210. <use xlink:href="#dsit-gongdanliebiao"></use>
  211. </svg>
  212. <div class="name">工单列表</div>
  213. <div class="fontclass">#dsit-gongdanliebiao</div>
  214. </li>
  215. <li>
  216. <svg class="icon" aria-hidden="true">
  217. <use xlink:href="#dsit-wenti"></use>
  218. </svg>
  219. <div class="name">问题</div>
  220. <div class="fontclass">#dsit-wenti</div>
  221. </li>
  222. <li>
  223. <svg class="icon" aria-hidden="true">
  224. <use xlink:href="#dsit-sousuo"></use>
  225. </svg>
  226. <div class="name">搜索</div>
  227. <div class="fontclass">#dsit-sousuo</div>
  228. </li>
  229. <li>
  230. <svg class="icon" aria-hidden="true">
  231. <use xlink:href="#dsit-morentouxiang"></use>
  232. </svg>
  233. <div class="name">默认头像</div>
  234. <div class="fontclass">#dsit-morentouxiang</div>
  235. </li>
  236. <li>
  237. <svg class="icon" aria-hidden="true">
  238. <use xlink:href="#dsit-fanhui"></use>
  239. </svg>
  240. <div class="name">返回</div>
  241. <div class="fontclass">#dsit-fanhui</div>
  242. </li>
  243. <li>
  244. <svg class="icon" aria-hidden="true">
  245. <use xlink:href="#dsit-bianji"></use>
  246. </svg>
  247. <div class="name">编辑</div>
  248. <div class="fontclass">#dsit-bianji</div>
  249. </li>
  250. <li>
  251. <svg class="icon" aria-hidden="true">
  252. <use xlink:href="#dsit-wode1"></use>
  253. </svg>
  254. <div class="name">我的</div>
  255. <div class="fontclass">#dsit-wode1</div>
  256. </li>
  257. <li>
  258. <svg class="icon" aria-hidden="true">
  259. <use xlink:href="#dsit-dui"></use>
  260. </svg>
  261. <div class="name">对</div>
  262. <div class="fontclass">#dsit-dui</div>
  263. </li>
  264. <li>
  265. <svg class="icon" aria-hidden="true">
  266. <use xlink:href="#dsit-guzhangbaojing"></use>
  267. </svg>
  268. <div class="name">故障报警</div>
  269. <div class="fontclass">#dsit-guzhangbaojing</div>
  270. </li>
  271. <li>
  272. <svg class="icon" aria-hidden="true">
  273. <use xlink:href="#dsit-yiji-fuwuguanli"></use>
  274. </svg>
  275. <div class="name">一级-服务管理</div>
  276. <div class="fontclass">#dsit-yiji-fuwuguanli</div>
  277. </li>
  278. <li>
  279. <svg class="icon" aria-hidden="true">
  280. <use xlink:href="#dsit-zhishiku2"></use>
  281. </svg>
  282. <div class="name">知识库</div>
  283. <div class="fontclass">#dsit-zhishiku2</div>
  284. </li>
  285. <li>
  286. <svg class="icon" aria-hidden="true">
  287. <use xlink:href="#dsit-yiyuqi"></use>
  288. </svg>
  289. <div class="name">已逾期</div>
  290. <div class="fontclass">#dsit-yiyuqi</div>
  291. </li>
  292. <li>
  293. <svg class="icon" aria-hidden="true">
  294. <use xlink:href="#dsit-jijiangyuqi"></use>
  295. </svg>
  296. <div class="name">即将逾期</div>
  297. <div class="fontclass">#dsit-jijiangyuqi</div>
  298. </li>
  299. <li>
  300. <svg class="icon" aria-hidden="true">
  301. <use xlink:href="#dsit-yuqi"></use>
  302. </svg>
  303. <div class="name">逾期</div>
  304. <div class="fontclass">#dsit-yuqi</div>
  305. </li>
  306. <li>
  307. <svg class="icon" aria-hidden="true">
  308. <use xlink:href="#dsit-mulu"></use>
  309. </svg>
  310. <div class="name">展开</div>
  311. <div class="fontclass">#dsit-mulu</div>
  312. </li>
  313. <li>
  314. <svg class="icon" aria-hidden="true">
  315. <use xlink:href="#dsit-xiangyou"></use>
  316. </svg>
  317. <div class="name">向右</div>
  318. <div class="fontclass">#dsit-xiangyou</div>
  319. </li>
  320. <li>
  321. <svg class="icon" aria-hidden="true">
  322. <use xlink:href="#dsit-paizhao"></use>
  323. </svg>
  324. <div class="name">C 拍照</div>
  325. <div class="fontclass">#dsit-paizhao</div>
  326. </li>
  327. <li>
  328. <svg class="icon" aria-hidden="true">
  329. <use xlink:href="#dsit-wode2"></use>
  330. </svg>
  331. <div class="name">我的</div>
  332. <div class="fontclass">#dsit-wode2</div>
  333. </li>
  334. <li>
  335. <svg class="icon" aria-hidden="true">
  336. <use xlink:href="#dsit-pingfen-copy"></use>
  337. </svg>
  338. <div class="name">评分</div>
  339. <div class="fontclass">#dsit-pingfen-copy</div>
  340. </li>
  341. <li>
  342. <svg class="icon" aria-hidden="true">
  343. <use xlink:href="#dsit-changjianwenti"></use>
  344. </svg>
  345. <div class="name">常见问题 (1)</div>
  346. <div class="fontclass">#dsit-changjianwenti</div>
  347. </li>
  348. <li>
  349. <svg class="icon" aria-hidden="true">
  350. <use xlink:href="#dsit-xinjian1"></use>
  351. </svg>
  352. <div class="name">新建 (1)</div>
  353. <div class="fontclass">#dsit-xinjian1</div>
  354. </li>
  355. <li>
  356. <svg class="icon" aria-hidden="true">
  357. <use xlink:href="#dsit-shouye-fuwuzhinan"></use>
  358. </svg>
  359. <div class="name">首页-服务指南</div>
  360. <div class="fontclass">#dsit-shouye-fuwuzhinan</div>
  361. </li>
  362. <li>
  363. <svg class="icon" aria-hidden="true">
  364. <use xlink:href="#dsit-gonggaotianchong"></use>
  365. </svg>
  366. <div class="name">公告填充</div>
  367. <div class="fontclass">#dsit-gonggaotianchong</div>
  368. </li>
  369. <li>
  370. <svg class="icon" aria-hidden="true">
  371. <use xlink:href="#dsit-baoxiuliebiao"></use>
  372. </svg>
  373. <div class="name">报修列表</div>
  374. <div class="fontclass">#dsit-baoxiuliebiao</div>
  375. </li>
  376. <li>
  377. <svg class="icon" aria-hidden="true">
  378. <use xlink:href="#dsit-shouji"></use>
  379. </svg>
  380. <div class="name">手机</div>
  381. <div class="fontclass">#dsit-shouji</div>
  382. </li>
  383. <li>
  384. <svg class="icon" aria-hidden="true">
  385. <use xlink:href="#dsit-changjianwenti1"></use>
  386. </svg>
  387. <div class="name">常见问题</div>
  388. <div class="fontclass">#dsit-changjianwenti1</div>
  389. </li>
  390. <li>
  391. <svg class="icon" aria-hidden="true">
  392. <use xlink:href="#dsit-ic"></use>
  393. </svg>
  394. <div class="name">首页</div>
  395. <div class="fontclass">#dsit-ic</div>
  396. </li>
  397. <li>
  398. <svg class="icon" aria-hidden="true">
  399. <use xlink:href="#dsit-icon_liucheng"></use>
  400. </svg>
  401. <div class="name">icon_liucheng</div>
  402. <div class="fontclass">#dsit-icon_liucheng</div>
  403. </li>
  404. <li>
  405. <svg class="icon" aria-hidden="true">
  406. <use xlink:href="#dsit-icon_zhengzaijinx"></use>
  407. </svg>
  408. <div class="name">icon_zhengzaijinx</div>
  409. <div class="fontclass">#dsit-icon_zhengzaijinx</div>
  410. </li>
  411. <li>
  412. <svg class="icon" aria-hidden="true">
  413. <use xlink:href="#dsit-icon_weizuo"></use>
  414. </svg>
  415. <div class="name">icon_weizuo</div>
  416. <div class="fontclass">#dsit-icon_weizuo</div>
  417. </li>
  418. <li>
  419. <svg class="icon" aria-hidden="true">
  420. <use xlink:href="#dsit-icon-test"></use>
  421. </svg>
  422. <div class="name">8</div>
  423. <div class="fontclass">#dsit-icon-test</div>
  424. </li>
  425. <li>
  426. <svg class="icon" aria-hidden="true">
  427. <use xlink:href="#dsit-icon-test1"></use>
  428. </svg>
  429. <div class="name">9</div>
  430. <div class="fontclass">#dsit-icon-test1</div>
  431. </li>
  432. <li>
  433. <svg class="icon" aria-hidden="true">
  434. <use xlink:href="#dsit-icon-test2"></use>
  435. </svg>
  436. <div class="name">7</div>
  437. <div class="fontclass">#dsit-icon-test2</div>
  438. </li>
  439. <li>
  440. <svg class="icon" aria-hidden="true">
  441. <use xlink:href="#dsit-icon-test3"></use>
  442. </svg>
  443. <div class="name">8</div>
  444. <div class="fontclass">#dsit-icon-test3</div>
  445. </li>
  446. <li>
  447. <svg class="icon" aria-hidden="true">
  448. <use xlink:href="#dsit-icon-test4"></use>
  449. </svg>
  450. <div class="name">4</div>
  451. <div class="fontclass">#dsit-icon-test4</div>
  452. </li>
  453. <li>
  454. <svg class="icon" aria-hidden="true">
  455. <use xlink:href="#dsit-icon-test5"></use>
  456. </svg>
  457. <div class="name">6</div>
  458. <div class="fontclass">#dsit-icon-test5</div>
  459. </li>
  460. <li>
  461. <svg class="icon" aria-hidden="true">
  462. <use xlink:href="#dsit-icon-test6"></use>
  463. </svg>
  464. <div class="name">5</div>
  465. <div class="fontclass">#dsit-icon-test6</div>
  466. </li>
  467. <li>
  468. <svg class="icon" aria-hidden="true">
  469. <use xlink:href="#dsit-icon-test7"></use>
  470. </svg>
  471. <div class="name">2</div>
  472. <div class="fontclass">#dsit-icon-test7</div>
  473. </li>
  474. <li>
  475. <svg class="icon" aria-hidden="true">
  476. <use xlink:href="#dsit-icon-test8"></use>
  477. </svg>
  478. <div class="name">3</div>
  479. <div class="fontclass">#dsit-icon-test8</div>
  480. </li>
  481. <li>
  482. <svg class="icon" aria-hidden="true">
  483. <use xlink:href="#dsit-Shape"></use>
  484. </svg>
  485. <div class="name">Shape</div>
  486. <div class="fontclass">#dsit-Shape</div>
  487. </li>
  488. <li>
  489. <svg class="icon" aria-hidden="true">
  490. <use xlink:href="#dsit-icon-test9"></use>
  491. </svg>
  492. <div class="name">10</div>
  493. <div class="fontclass">#dsit-icon-test9</div>
  494. </li>
  495. </ul>
  496. <h2 id="symbol-">symbol引用</h2>
  497. <hr>
  498. <p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
  499. 这种用法其实是做了一个svg的集合,与另外两种相比具有如下特点:</p>
  500. <ul>
  501. <li>支持多色图标了,不再受单色限制。</li>
  502. <li>通过一些技巧,支持像字体那样,通过<code>font-size</code>,<code>color</code>来调整样式。</li>
  503. <li>兼容性较差,支持 ie9+,及现代浏览器。</li>
  504. <li>浏览器渲染svg的性能一般,还不如png。</li>
  505. </ul>
  506. <p>使用步骤如下:</p>
  507. <h3 id="-symbol-">第一步:引入项目下面生成的symbol代码:</h3>
  508. <pre><code class="lang-js hljs javascript"><span class="hljs-comment">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;</span></code></pre>
  509. <h3 id="-css-">第二步:加入通用css代码(引入一次就行):</h3>
  510. <pre><code class="lang-js hljs javascript">&lt;style type=<span class="hljs-string">"text/css"</span>&gt;
  511. .icon {
  512. width: <span class="hljs-number">1</span>em; height: <span class="hljs-number">1</span>em;
  513. vertical-align: <span class="hljs-number">-0.15</span>em;
  514. fill: currentColor;
  515. overflow: hidden;
  516. }
  517. &lt;<span class="hljs-regexp">/style&gt;</span></code></pre>
  518. <h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
  519. <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">
  520. &lt;<span class="hljs-name">use</span> <span class="hljs-attr">xlink:href</span>=<span class="hljs-string">"#dsit-xxx"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">use</span>&gt;</span>
  521. </span>&lt;<span class="hljs-regexp">/svg&gt;
  522. </span></code></pre>
  523. </div>
  524. </body>
  525. </html>