css - 图标字体不显示某些图标

标签 css fonts icons

我有自己的图标字体,所以上面有 10 个图标。主要问题如下。 其中 8 个在网站上显示良好,但其中 2 个显示为我给他们的字母('f' 和 'e')

例如,这是我插入图标的方式

.test-icon-user1:before {content: "\61";}
.test-icon-user2:before {content: "\62";}
.test-icon-user3:before {content: "\63";}
.test-icon-user4:before {content: "\64";}
.test-icon-user5:before {content: "\65";}
.test-icon-user6:before {content: "\66";}
.test-icon-user7:before {content: "\67";}

其中只有 2 个不起作用...这很奇怪,因为我插入它们的方式相同,样式表加载正常,一切看起来都很好。

enter image description here

这是它的样子。

这是我通过html插入的方式(名称与原始名称不完全相同,所以我检查了任何可能的拼写错误)

<a id="sticky-login-toggle" class="test-icon-user1 sticky-toggle"></a>

最后是我如何插入图标字体

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

}

[class^="icon-"]:before,
[class*=" test-icon-"]:before {
  font-family: "test" !important;
  font-style: normal !important;
  font-weight: normal !important;
  font-variant: normal !important;
  text-transform: none !important;
  speak: none;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

最佳答案

答案在这里。

FontAwesome icons not showing. Why?

codepen 仍然是 actvia。您可以将您的代码粘贴到那里,看看是否有效

http://codepen.io/TheNathanG/pen/xbyFg

我有自己的图标字体,所以上面有 10 个图标。主要问题如下。其中 8 个在网站上显示良好,但其中 2 个显示为我给他们的字母('f' 和 'e')

例如,这是我插入图标的方式

.test-icon-user1:before {content: "\61";}
.test-icon-user2:before {content: "\62";}
.test-icon-user3:before {content: "\63";}
.test-icon-user4:before {content: "\64";}
.test-icon-user5:before {content: "\65";}
.test-icon-user6:before {content: "\66";}
.test-icon-user7:before {content: "\67";}

关于css - 图标字体不显示某些图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35807601/

相关文章:

jquery - Select2 和 CSS 转换 : dropdown menu is off position

html - 边框 css 变化比变换旋转更快

html - 如何在 Wordpress 中添加指向硬编码图像的链接?

javascript - 在没有 html lang 标签的情况下更改不同语言的字体和字体大小

image - 使用 cx_Freeze 构建时,图标未显示在 PyQt 应用程序 exe 中

html - dir ="rtl"IE7 输入字段改变焦点位置

css - 歌剧中的自定义字体问题

JavaFX 2.2 字体渲染有问题

icons - 图标采购 : make one, 买一或找一

c# - 从给定路径加载图标以显示在 WPF 窗口中