@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?ofght5');
src: url('fonts/icomoon.eot?ofght5#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?ofght5') format('truetype'),
url('fonts/icomoon.woff?ofght5') format('woff'),
url('fonts/icomoon.svg?ofght5#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
[class^="icon-"], [class*=" icon-"] {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: 'icomoon' !important;
speak: never;
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-home:before {
content: "\e900";
}
Unicode 使用步骤如下:
第一步:拷贝项目下面生成的 @font-face
@font-face {
font-family: 'iconfont';
src: url('iconfont.woff2?t=1642085650271') format('woff2'),
url('iconfont.woff?t=1642085650271') format('woff'),
url('iconfont.ttf?t=1642085650271') format('truetype');
}
第二步:定义使用 iconfont 的样式
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
第三步:挑选相应图标并获取字体编码,应用于页面
<span class="iconfont">3</span>