终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

461 lines
16 KiB

  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. </div>
  47. <div class="tab-container">
  48. <div class="content unicode" style="display: block;">
  49. <ul class="icon_lists dib-box">
  50. <li class="dib">
  51. <span class="icon iconfont">&#xe622;</span>
  52. <div class="name">下载</div>
  53. <div class="code-name">&amp;#xe622;</div>
  54. </li>
  55. <li class="dib">
  56. <span class="icon iconfont">&#xe668;</span>
  57. <div class="name">账号信息</div>
  58. <div class="code-name">&amp;#xe668;</div>
  59. </li>
  60. <li class="dib">
  61. <span class="icon iconfont">&#xe695;</span>
  62. <div class="name">窗口-最大化_line</div>
  63. <div class="code-name">&amp;#xe695;</div>
  64. </li>
  65. <li class="dib">
  66. <span class="icon iconfont">&#xe62b;</span>
  67. <div class="name">密码</div>
  68. <div class="code-name">&amp;#xe62b;</div>
  69. </li>
  70. <li class="dib">
  71. <span class="icon iconfont">&#xe62c;</span>
  72. <div class="name">权限配置</div>
  73. <div class="code-name">&amp;#xe62c;</div>
  74. </li>
  75. <li class="dib">
  76. <span class="icon iconfont">&#xe63f;</span>
  77. <div class="name">下载</div>
  78. <div class="code-name">&amp;#xe63f;</div>
  79. </li>
  80. <li class="dib">
  81. <span class="icon iconfont">&#xe669;</span>
  82. <div class="name">close</div>
  83. <div class="code-name">&amp;#xe669;</div>
  84. </li>
  85. <li class="dib">
  86. <span class="icon iconfont">&#xe67a;</span>
  87. <div class="name">minus</div>
  88. <div class="code-name">&amp;#xe67a;</div>
  89. </li>
  90. <li class="dib">
  91. <span class="icon iconfont">&#xe6a0;</span>
  92. <div class="name">账号中心 账号管理</div>
  93. <div class="code-name">&amp;#xe6a0;</div>
  94. </li>
  95. <li class="dib">
  96. <span class="icon iconfont">&#xe979;</span>
  97. <div class="name">齿轮,设置,设定</div>
  98. <div class="code-name">&amp;#xe979;</div>
  99. </li>
  100. <li class="dib">
  101. <span class="icon iconfont">&#xe6b7;</span>
  102. <div class="name">面性密码锁</div>
  103. <div class="code-name">&amp;#xe6b7;</div>
  104. </li>
  105. <li class="dib">
  106. <span class="icon iconfont">&#xe8e0;</span>
  107. <div class="name">166-NFC</div>
  108. <div class="code-name">&amp;#xe8e0;</div>
  109. </li>
  110. </ul>
  111. <div class="article markdown">
  112. <h2 id="unicode-">Unicode 引用</h2>
  113. <hr>
  114. <p>Unicode 是字体在网页端最原始的应用方式,特点是:</p>
  115. <ul>
  116. <li>支持按字体的方式去动态调整图标大小,颜色等等。</li>
  117. <li>默认情况下不支持多色,直接添加多色图标会自动去色。</li>
  118. </ul>
  119. <blockquote>
  120. <p>注意:新版 iconfont 支持两种方式引用多色图标:SVG symbol 引用方式和彩色字体图标模式。(使用彩色字体图标需要在「编辑项目」中开启「彩色」选项后并重新生成。)</p>
  121. </blockquote>
  122. <p>Unicode 使用步骤如下:</p>
  123. <h3 id="-font-face">第一步:拷贝项目下面生成的 <code>@font-face</code></h3>
  124. <pre><code class="language-css"
  125. >@font-face {
  126. font-family: 'iconfont';
  127. src: url('iconfont.ttf?t=1659497763775') format('truetype');
  128. }
  129. </code></pre>
  130. <h3 id="-iconfont-">第二步:定义使用 iconfont 的样式</h3>
  131. <pre><code class="language-css"
  132. >.iconfont {
  133. font-family: "iconfont" !important;
  134. font-size: 16px;
  135. font-style: normal;
  136. -webkit-font-smoothing: antialiased;
  137. -moz-osx-font-smoothing: grayscale;
  138. }
  139. </code></pre>
  140. <h3 id="-">第三步:挑选相应图标并获取字体编码,应用于页面</h3>
  141. <pre>
  142. <code class="language-html"
  143. >&lt;span class="iconfont"&gt;&amp;#x33;&lt;/span&gt;
  144. </code></pre>
  145. <blockquote>
  146. <p>"iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
  147. </blockquote>
  148. </div>
  149. </div>
  150. <div class="content font-class">
  151. <ul class="icon_lists dib-box">
  152. <li class="dib">
  153. <span class="icon iconfont icon-xiazai"></span>
  154. <div class="name">
  155. 下载
  156. </div>
  157. <div class="code-name">.icon-xiazai
  158. </div>
  159. </li>
  160. <li class="dib">
  161. <span class="icon iconfont icon-zhanghaoxinxi"></span>
  162. <div class="name">
  163. 账号信息
  164. </div>
  165. <div class="code-name">.icon-zhanghaoxinxi
  166. </div>
  167. </li>
  168. <li class="dib">
  169. <span class="icon iconfont icon-window-max_line"></span>
  170. <div class="name">
  171. 窗口-最大化_line
  172. </div>
  173. <div class="code-name">.icon-window-max_line
  174. </div>
  175. </li>
  176. <li class="dib">
  177. <span class="icon iconfont icon-mima"></span>
  178. <div class="name">
  179. 密码
  180. </div>
  181. <div class="code-name">.icon-mima
  182. </div>
  183. </li>
  184. <li class="dib">
  185. <span class="icon iconfont icon-quanxianpeizhi"></span>
  186. <div class="name">
  187. 权限配置
  188. </div>
  189. <div class="code-name">.icon-quanxianpeizhi
  190. </div>
  191. </li>
  192. <li class="dib">
  193. <span class="icon iconfont icon-xiazai1"></span>
  194. <div class="name">
  195. 下载
  196. </div>
  197. <div class="code-name">.icon-xiazai1
  198. </div>
  199. </li>
  200. <li class="dib">
  201. <span class="icon iconfont icon-close"></span>
  202. <div class="name">
  203. close
  204. </div>
  205. <div class="code-name">.icon-close
  206. </div>
  207. </li>
  208. <li class="dib">
  209. <span class="icon iconfont icon-minus"></span>
  210. <div class="name">
  211. minus
  212. </div>
  213. <div class="code-name">.icon-minus
  214. </div>
  215. </li>
  216. <li class="dib">
  217. <span class="icon iconfont icon-zhanghaozhongxinzhanghaoguanli"></span>
  218. <div class="name">
  219. 账号中心 账号管理
  220. </div>
  221. <div class="code-name">.icon-zhanghaozhongxinzhanghaoguanli
  222. </div>
  223. </li>
  224. <li class="dib">
  225. <span class="icon iconfont icon-set"></span>
  226. <div class="name">
  227. 齿轮,设置,设定
  228. </div>
  229. <div class="code-name">.icon-set
  230. </div>
  231. </li>
  232. <li class="dib">
  233. <span class="icon iconfont icon-mianxingmima"></span>
  234. <div class="name">
  235. 面性密码锁
  236. </div>
  237. <div class="code-name">.icon-mianxingmima
  238. </div>
  239. </li>
  240. <li class="dib">
  241. <span class="icon iconfont icon-a-166-NFC"></span>
  242. <div class="name">
  243. 166-NFC
  244. </div>
  245. <div class="code-name">.icon-a-166-NFC
  246. </div>
  247. </li>
  248. </ul>
  249. <div class="article markdown">
  250. <h2 id="font-class-">font-class 引用</h2>
  251. <hr>
  252. <p>font-class 是 Unicode 使用方式的一种变种,主要是解决 Unicode 书写不直观,语意不明确的问题。</p>
  253. <p>与 Unicode 使用方式相比,具有如下特点:</p>
  254. <ul>
  255. <li>相比于 Unicode 语意明确,书写更直观。可以很容易分辨这个 icon 是什么。</li>
  256. <li>因为使用 class 来定义图标,所以当要替换图标时,只需要修改 class 里面的 Unicode 引用。</li>
  257. </ul>
  258. <p>使用步骤如下:</p>
  259. <h3 id="-fontclass-">第一步:引入项目下面生成的 fontclass 代码:</h3>
  260. <pre><code class="language-html">&lt;link rel="stylesheet" href="./iconfont.css"&gt;
  261. </code></pre>
  262. <h3 id="-">第二步:挑选相应图标并获取类名,应用于页面:</h3>
  263. <pre><code class="language-html">&lt;span class="iconfont icon-xxx"&gt;&lt;/span&gt;
  264. </code></pre>
  265. <blockquote>
  266. <p>"
  267. iconfont" 是你项目下的 font-family。可以通过编辑项目查看,默认是 "iconfont"。</p>
  268. </blockquote>
  269. </div>
  270. </div>
  271. <div class="content symbol">
  272. <ul class="icon_lists dib-box">
  273. <li class="dib">
  274. <svg class="icon svg-icon" aria-hidden="true">
  275. <use xlink:href="#icon-xiazai"></use>
  276. </svg>
  277. <div class="name">下载</div>
  278. <div class="code-name">#icon-xiazai</div>
  279. </li>
  280. <li class="dib">
  281. <svg class="icon svg-icon" aria-hidden="true">
  282. <use xlink:href="#icon-zhanghaoxinxi"></use>
  283. </svg>
  284. <div class="name">账号信息</div>
  285. <div class="code-name">#icon-zhanghaoxinxi</div>
  286. </li>
  287. <li class="dib">
  288. <svg class="icon svg-icon" aria-hidden="true">
  289. <use xlink:href="#icon-window-max_line"></use>
  290. </svg>
  291. <div class="name">窗口-最大化_line</div>
  292. <div class="code-name">#icon-window-max_line</div>
  293. </li>
  294. <li class="dib">
  295. <svg class="icon svg-icon" aria-hidden="true">
  296. <use xlink:href="#icon-mima"></use>
  297. </svg>
  298. <div class="name">密码</div>
  299. <div class="code-name">#icon-mima</div>
  300. </li>
  301. <li class="dib">
  302. <svg class="icon svg-icon" aria-hidden="true">
  303. <use xlink:href="#icon-quanxianpeizhi"></use>
  304. </svg>
  305. <div class="name">权限配置</div>
  306. <div class="code-name">#icon-quanxianpeizhi</div>
  307. </li>
  308. <li class="dib">
  309. <svg class="icon svg-icon" aria-hidden="true">
  310. <use xlink:href="#icon-xiazai1"></use>
  311. </svg>
  312. <div class="name">下载</div>
  313. <div class="code-name">#icon-xiazai1</div>
  314. </li>
  315. <li class="dib">
  316. <svg class="icon svg-icon" aria-hidden="true">
  317. <use xlink:href="#icon-close"></use>
  318. </svg>
  319. <div class="name">close</div>
  320. <div class="code-name">#icon-close</div>
  321. </li>
  322. <li class="dib">
  323. <svg class="icon svg-icon" aria-hidden="true">
  324. <use xlink:href="#icon-minus"></use>
  325. </svg>
  326. <div class="name">minus</div>
  327. <div class="code-name">#icon-minus</div>
  328. </li>
  329. <li class="dib">
  330. <svg class="icon svg-icon" aria-hidden="true">
  331. <use xlink:href="#icon-zhanghaozhongxinzhanghaoguanli"></use>
  332. </svg>
  333. <div class="name">账号中心 账号管理</div>
  334. <div class="code-name">#icon-zhanghaozhongxinzhanghaoguanli</div>
  335. </li>
  336. <li class="dib">
  337. <svg class="icon svg-icon" aria-hidden="true">
  338. <use xlink:href="#icon-set"></use>
  339. </svg>
  340. <div class="name">齿轮,设置,设定</div>
  341. <div class="code-name">#icon-set</div>
  342. </li>
  343. <li class="dib">
  344. <svg class="icon svg-icon" aria-hidden="true">
  345. <use xlink:href="#icon-mianxingmima"></use>
  346. </svg>
  347. <div class="name">面性密码锁</div>
  348. <div class="code-name">#icon-mianxingmima</div>
  349. </li>
  350. <li class="dib">
  351. <svg class="icon svg-icon" aria-hidden="true">
  352. <use xlink:href="#icon-a-166-NFC"></use>
  353. </svg>
  354. <div class="name">166-NFC</div>
  355. <div class="code-name">#icon-a-166-NFC</div>
  356. </li>
  357. </ul>
  358. <div class="article markdown">
  359. <h2 id="symbol-">Symbol 引用</h2>
  360. <hr>
  361. <p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
  362. 这种用法其实是做了一个 SVG 的集合,与另外两种相比具有如下特点:</p>
  363. <ul>
  364. <li>支持多色图标了,不再受单色限制。</li>
  365. <li>通过一些技巧,支持像字体那样,通过 <code>font-size</code>, <code>color</code> 来调整样式。</li>
  366. <li>兼容性较差,支持 IE9+,及现代浏览器。</li>
  367. <li>浏览器渲染 SVG 的性能一般,还不如 png。</li>
  368. </ul>
  369. <p>使用步骤如下:</p>
  370. <h3 id="-symbol-">第一步:引入项目下面生成的 symbol 代码:</h3>
  371. <pre><code class="language-html">&lt;script src="./iconfont.js"&gt;&lt;/script&gt;
  372. </code></pre>
  373. <h3 id="-css-">第二步:加入通用 CSS 代码(引入一次就行):</h3>
  374. <pre><code class="language-html">&lt;style&gt;
  375. .icon {
  376. width: 1em;
  377. height: 1em;
  378. vertical-align: -0.15em;
  379. fill: currentColor;
  380. overflow: hidden;
  381. }
  382. &lt;/style&gt;
  383. </code></pre>
  384. <h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
  385. <pre><code class="language-html">&lt;svg class="icon" aria-hidden="true"&gt;
  386. &lt;use xlink:href="#icon-xxx"&gt;&lt;/use&gt;
  387. &lt;/svg&gt;
  388. </code></pre>
  389. </div>
  390. </div>
  391. </div>
  392. </div>
  393. <script>
  394. $(document).ready(function () {
  395. $('.tab-container .content:first').show()
  396. $('#tabs li').click(function (e) {
  397. var tabContent = $('.tab-container .content')
  398. var index = $(this).index()
  399. if ($(this).hasClass('active')) {
  400. return
  401. } else {
  402. $('#tabs li').removeClass('active')
  403. $(this).addClass('active')
  404. tabContent.hide().eq(index).fadeIn()
  405. }
  406. })
  407. })
  408. </script>
  409. </body>
  410. </html>