我试图弄清楚如何将Icomoon字体合并到我的网站中,但是无法加载该字体。我下载了文件并将它们处理到我的/ fonts目录中。然后,按照here的说明进行操作,并将icomoon / fonts中的文件复制到/ fonts。我将icomoon / style.css编辑为:

@font-face {
font-family: 'icomoon';
src:url('../fonts/icomoon.eot');
src:url('../fonts/icomoon.eot?#iefix') format('embedded-opentype'),
    url('../fonts/icomoon.woff') format('woff'),
    url('../fonts/icomoon.ttf') format('truetype'),
    url('../fonts/icomoon.svg') format('svg');
font-weight: normal;
font-style: normal;
}


我将其包含在我的style.scss“ @import” ../fonts/icomoon/style.css“;”中。在我的pages之一上,我尝试添加一个图标,但没有显示。我究竟做错了什么?

最佳答案

好吧,我知道了。我将icomoon / style.css更改为:

@font-face {
font-family: 'icomoon';
src:url('../icomoon.eot');
src:url('../icomoon.eot?#iefix') format('embedded-opentype'),
url('../icomoon.woff') format('woff'),
url('../icomoon.ttf') format('truetype'),
url('../icomoon.svg') format('svg');
font-weight: normal;
font-style: normal;
}


然后将style.scss中的调用更改为“ @import url(“ ../ fonts / icomoon / style.css”);“。感谢大家的帮助。

10-06 08:12