1, first of all can go iconfont.cn Alibaba vector font library download icon you want (select the format for the SNG
format).
2, open iconmoon this site (like this), then click on the upper right corner of the Iconfont App
figure below:
3, above a purple Import Icons
Click Upload your next good SVG
icon.
4, upload good SVG
icon appears below Untitled Set
, and then select the top have a similar 笔
shape of the icon, click into the edit. Explain the above selector. 。鼠标箭头
Represents 选择图标
。垃圾桶
represents 删除图标
, generally opt for trash, 点一下图标就可删除
。十字箭头
expressed变换位置
5, the editing, the first Tags
is that you can enter the name you want to find when this icon, the second input box will be used when the code references 名字
. I created the flower, so named flower
, and then close the editor, do not point to download.
6, then click on the bottom right Generate Font F
, is entering the page, then click the red circle in the gear, the next step editor
7. Once there, you need to modify the following.
8, Font Name
represents a moment introduced fonts need to be introduced 样式名称
Class Prefix
redistributes style prefix, suffix if not set, then introduced to the style nameicon-flower
9, selection Support IE 8
and Generate preprocessor variables for: Less
andUse a class
Then fill in the back of the box css need to be introduced 类名
, I wrote .wyhicon
the name of
10, and then close the editor, click on 右下角download下载
the font.
11, after the download is complete, press solution. Modify style.css
content
/* 我们需将下面的url路径改为引用的fonts文件夹的路径,根据实际情况修改 */
@font-face {
font-family: 'wyhicon';
src: url('../fonts/wyhicon.eot?q06q0o');
src: url('../fonts/wyhicon.eot?q06q0o#iefix') format('embedded-opentype'),
url('../fonts/wyhicon.ttf?q06q0o') format('truetype'),
url('../fonts/wyhicon.woff?q06q0o') format('woff'),
url('../fonts/wyhicon.svg?q06q0o#wyhicon') format('svg');
...
}
/* 下方这个类中的字体样式需要加上以下代码中的font-family */
.wyhicon {
font-family: 'wyhicon',PingFangSC-Light,'helvetica neue','hiragino sans gb',arial,'microsoft yahei ui','microsoft yahei',simsun,sans-serif !important;
...
}
.icon-flower:before {
content: "\e900";
}
I.e. the original
style.css样式
in.wyhicon
addition at a font-family:
'wyhicon', PingFangSC-Light, 'Neue Helvetica', 'Hiragino Sans
GB', Arial, 'YaHei Microsoft UI', 'Microsoft YaHei', simsun, sans- serif
! Important;
11, then reference in your html document on it
<!-- 首先引用你的css样式 -->
<link rel="stylesheet" href="./css/style.css" type="text/css">
<!-- 然后引入你的字体文件就ok了 -->
<i class=" wyhicon icon-flower"></i>