123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8"/>
- <title>IconFont</title>
- <link rel="stylesheet" href="demo.css">
- <script src="iconfont.js"></script>
- <style type="text/css">
- .icon {
- /* 通过设置 font-size 来改变图标大小 */
- width: 1em; height: 1em;
- /* 图标和文字相邻时,垂直对齐 */
- vertical-align: -0.15em;
- /* 通过设置 color 来改变 SVG 的颜色/fill */
- fill: currentColor;
- /* path 和 stroke 溢出 viewBox 部分在 IE 下会显示
- normalize.css 中也包含这行 */
- overflow: hidden;
- }
- </style>
- </head>
- <body>
- <div class="main markdown">
- <h1>IconFont 图标</h1>
- <ul class="icon_lists clear">
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-add"></use>
- </svg>
- <div class="name">add</div>
- <div class="fontclass">#icon-add</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-gongdan"></use>
- </svg>
- <div class="name">gongdan2</div>
- <div class="fontclass">#icon-gongdan</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-gongdan1"></use>
- </svg>
- <div class="name">gongdan</div>
- <div class="fontclass">#icon-gongdan1</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-home"></use>
- </svg>
- <div class="name">home</div>
- <div class="fontclass">#icon-home</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-more"></use>
- </svg>
- <div class="name">more</div>
- <div class="fontclass">#icon-more</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-message"></use>
- </svg>
- <div class="name">message</div>
- <div class="fontclass">#icon-message</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-peo"></use>
- </svg>
- <div class="name">peo2</div>
- <div class="fontclass">#icon-peo</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-people"></use>
- </svg>
- <div class="name">people</div>
- <div class="fontclass">#icon-people</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-peo1"></use>
- </svg>
- <div class="name">peo3</div>
- <div class="fontclass">#icon-peo1</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-search"></use>
- </svg>
- <div class="name">search</div>
- <div class="fontclass">#icon-search</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-sort"></use>
- </svg>
- <div class="name">sort1</div>
- <div class="fontclass">#icon-sort</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-start"></use>
- </svg>
- <div class="name">start</div>
- <div class="fontclass">#icon-start</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-start1"></use>
- </svg>
- <div class="name">start 2</div>
- <div class="fontclass">#icon-start1</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-anquancanshu"></use>
- </svg>
- <div class="name">安全参数</div>
- <div class="fontclass">#icon-anquancanshu</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-dangqianbaojing"></use>
- </svg>
- <div class="name">当前报警</div>
- <div class="fontclass">#icon-dangqianbaojing</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-huanjing"></use>
- </svg>
- <div class="name">环境</div>
- <div class="fontclass">#icon-huanjing</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-huanjinglogo"></use>
- </svg>
- <div class="name">环境logo</div>
- <div class="fontclass">#icon-huanjinglogo</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-huiyuanmanyidu"></use>
- </svg>
- <div class="name">会员满意度</div>
- <div class="fontclass">#icon-huiyuanmanyidu</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-jiancedian"></use>
- </svg>
- <div class="name">监测点</div>
- <div class="fontclass">#icon-jiancedian</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-lengzhanlogo"></use>
- </svg>
- <div class="name">冷站logo</div>
- <div class="fontclass">#icon-lengzhanlogo</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-nengyuanlogo"></use>
- </svg>
- <div class="name">能源logo</div>
- <div class="fontclass">#icon-nengyuanlogo</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-pingfen"></use>
- </svg>
- <div class="name">评分</div>
- <div class="fontclass">#icon-pingfen</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-peidianlogo"></use>
- </svg>
- <div class="name">配电logo</div>
- <div class="fontclass">#icon-peidianlogo</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-qushi"></use>
- </svg>
- <div class="name">趋势</div>
- <div class="fontclass">#icon-qushi</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-qiangdianzhuanyexitong"></use>
- </svg>
- <div class="name">强电专业系统</div>
- <div class="fontclass">#icon-qiangdianzhuanyexitong</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-shenghuoreshui"></use>
- </svg>
- <div class="name">生活热水</div>
- <div class="fontclass">#icon-shenghuoreshui</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-xiangmudafenbiao"></use>
- </svg>
- <div class="name">项目打分表</div>
- <div class="fontclass">#icon-xiangmudafenbiao</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-kongzhuangtaiicon"></use>
- </svg>
- <div class="name">空状态icon</div>
- <div class="fontclass">#icon-kongzhuangtaiicon</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-tongjifenxiblue"></use>
- </svg>
- <div class="name">统计分析blue</div>
- <div class="fontclass">#icon-tongjifenxiblue</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-yujing"></use>
- </svg>
- <div class="name">预警</div>
- <div class="fontclass">#icon-yujing</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-zonglan"></use>
- </svg>
- <div class="name">总览</div>
- <div class="fontclass">#icon-zonglan</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-zulinlogo"></use>
- </svg>
- <div class="name">租赁logo</div>
- <div class="fontclass">#icon-zulinlogo</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-zhanghao"></use>
- </svg>
- <div class="name">账号</div>
- <div class="fontclass">#icon-zhanghao</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-close"></use>
- </svg>
- <div class="name">close</div>
- <div class="fontclass">#icon-close</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-mima"></use>
- </svg>
- <div class="name">密码</div>
- <div class="fontclass">#icon-mima</div>
- </li>
-
- <li>
- <svg class="icon" aria-hidden="true">
- <use xlink:href="#icon-meos"></use>
- </svg>
- <div class="name">meos</div>
- <div class="fontclass">#icon-meos</div>
- </li>
-
- </ul>
- <h2 id="symbol-">symbol引用</h2>
- <hr>
- <p>这是一种全新的使用方式,应该说这才是未来的主流,也是平台目前推荐的用法。相关介绍可以参考这篇<a href="">文章</a>
- 这种用法其实是做了一个svg的集合,与另外两种相比具有如下特点:</p>
- <ul>
- <li>支持多色图标了,不再受单色限制。</li>
- <li>通过一些技巧,支持像字体那样,通过<code>font-size</code>,<code>color</code>来调整样式。</li>
- <li>兼容性较差,支持 ie9+,及现代浏览器。</li>
- <li>浏览器渲染svg的性能一般,还不如png。</li>
- </ul>
- <p>使用步骤如下:</p>
- <h3 id="-symbol-">第一步:引入项目下面生成的symbol代码:</h3>
- <pre><code class="lang-js hljs javascript"><span class="hljs-comment"><script src="./iconfont.js"></script></span></code></pre>
- <h3 id="-css-">第二步:加入通用css代码(引入一次就行):</h3>
- <pre><code class="lang-js hljs javascript"><style type=<span class="hljs-string">"text/css"</span>>
- .icon {
- width: <span class="hljs-number">1</span>em; height: <span class="hljs-number">1</span>em;
- vertical-align: <span class="hljs-number">-0.15</span>em;
- fill: currentColor;
- overflow: hidden;
- }
- <<span class="hljs-regexp">/style></span></code></pre>
- <h3 id="-">第三步:挑选相应图标并获取类名,应用于页面:</h3>
- <pre><code class="lang-js hljs javascript"><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>><span class="xml"><span class="hljs-tag">
- <<span class="hljs-name">use</span> <span class="hljs-attr">xlink:href</span>=<span class="hljs-string">"#icon-xxx"</span>></span><span class="hljs-tag"></<span class="hljs-name">use</span>></span>
- </span><<span class="hljs-regexp">/svg>
- </span></code></pre>
- </div>
- </body>
- </html>
|