【发布时间】:2016-01-04 07:33:22
【问题描述】:
我使用了一些来自https://icomoon.io/app/#/select的图标字体
当我使用生成的 CSS 时,它可以从实际 HTML 页面上的样式标签正常工作:
<style>
@font-face {
font-family: 'icomoon';
src: url('fonts/icomoon.eot?hsw0h3');
src: url('fonts/icomoon.eot?hsw0h3#iefix') format('embedded-opentype'),
url('fonts/icomoon.ttf?hsw0h3') format('truetype'),
url('fonts/icomoon.woff?hsw0h3') format('woff'),
url('fonts/icomoon.svg?hsw0h3#icomoon') format('svg');
font-weight: normal;
font-style: normal;
}
</style>
当我将 CSS 放入我的 CSS 文件并调整路径时:
@font-face {
font-family: 'icomoon';
font-style: normal;
font-weight: normal;
src: url('../fonts/icomoon.eot?hsw0h3#iefix') format('embedded-opentype'), url('../fonts/icomoon.ttf?hsw0h3') format('truetype'), url('../fonts/icomoon.woff?hsw0h3') format('woff'), url('../fonts/icomoon.svg?hsw0h3#icomoon') format('svg');
src: url('../fonts/icomoon.eot?hsw0h3');
}
我在开发者控制台中收到此错误:
Failed to decode downloaded font: file:///C:/Users/Daisy/Desktop/softstack%20consulting/fonts/icomoon.eot?hsw0h3
OTS parsing error: invalid version tag
我不明白为什么仅通过移动 CSS 并更改其路径就无法解码字体。我做错了什么,我该如何解决?
【问题讨论】: