1.访问链接转换svg字体的网站
Paste_Image.png
2.导入SVG图标
Paste_Image.png
Paste_Image.png
3.选中你要转换的SVG图标
Paste_Image.png
Paste_Image.png
4.设置信息
设置icon名称以及相关信息
Paste_Image.png
Paste_Image.png
生成例子以及相关样式代码:
Paste_Image.png
5.主要是生成的css文件
style.css
@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里面的所有文件拷贝到你需要的开发环境
Paste_Image.png
6.实际调用
只需要给相关的类名即可以,类名就是之前生成的时候你编写的名字前面加上icon-,如果没有改,就是你svg文件的名字。
<span class="icon-appicon"></span>
Paste_Image.png










网友评论