###1.访问链接转换svg字体的网站 https://icomoon.io/
###2.导入SVG图标
###3.选中你要转换的SVG图标
###4.设置信息 设置icon名称以及相关信息
生成例子以及相关样式代码:
@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?xhzg4r');
src: url('fonts/icomoon.eot?xhzg4r#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?xhzg4r') format('truetype'),
url('fonts/icomoon.woff?xhzg4r') format('woff'),
url('fonts/icomoon.svg?xhzg4r#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
[class^="icon-"], [class*=" icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icomoon' !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-appicon:before {
content: "\e902";
}
复制代码
把生成的fonts里面的所有文件拷贝到你需要的开发环境
###6.实际调用 只需要给相关的类名即可以,类名就是之前生成的时候你编写的名字前面加上icon-,如果没有改,就是你svg文件的名字。
<span class="icon-appicon"></span>
复制代码