项目中字体库成功加载,但是无法显示

字体库加载成功

clipboard.png

但是却无法正常显示,本地开发环境可以正常显示
很奇怪不知道是啥原因

clipboard.png

clipboard.png

这是字体库文件的引用和加载代码

@font-face {
  font-family: 'icomoon';
  src:  url('../fonts/icomoon.eot?q7r210');
  src:  url('../fonts/icomoon.eot?q7r210#iefix') format('embedded-opentype'),
  url('../fonts/icomoon.ttf?q7r210') format('truetype'),
  url('../fonts/icomoon.woff?q7r210') format('woff'),
  url('../fonts/icomoon.svg?q7r210#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-32:before {
  content: "\e900";
}
.icon-2444:before {
  content: "\e901";
}
阅读 3.7k
3 个回答
Failed to decode downloaded font

问题解决了,之前报的这个错,一直没看到。
是后端打包的时候,对字体库进行编译,把字体库文件损坏了。

<webResources>
<resource>
<directory>src/main/webapp</directory>
<filtering>false</filtering>
</resource>
</webResources>

打包的把字体库过滤掉。就可以了
可以参考这个答案

相对路径绝对路径的问题?

你没写 font-family: "iconfont"

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题