自定义图标字体在IE8上无法正常工作

时间:2014-01-28 09:25:42

标签: css fonts internet-explorer-8

我们使用图标font-face在我们的网站上显示社交媒体图标,但它们在IE8中无法正确显示。

但奇怪的是,它们在我们的测试服务器上显示正常,而不是在网站上线时,这里可以看到 -

测试服务器
Icons on our test server
直播服务器
Icons on the live server

我猜测服务器配置可能是罪魁祸首,但我真的不知道该找什么。有人知道是什么原因引起的吗?感谢。

以下是我使用的CSS,由IcoMoon -

生成
@font-face{
    font-family: 'DD_Icons';
    src: url('fonts/DD_Icons.eot');
}
@font-face{
    font-family: 'DD_Icons';
    src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAALAIAAAwAwT1MvMg6yAy8AAAC8AAAAYGNtYXDmFwCHAAABHAAAAERnYXNwAAAAEAAAAWAAAAAIZ2x5ZjRvKIAAAAFoAAAF6GhlYWQBWCRDAAAHUAAAADZoaGVhB/UEUgAAB4gAAAAkaG10eBqJAFYAAAesAAAAIGxvY2EFgAPMAAAHzAAAABJtYXhwAA8AtwAAB+AAAAAgbmFtZbhi99gAAAgAAAABQnBvc3QAAwAAAAAJRAAAACAAAwQAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAACDmBQPA/8D/wAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADAAAAAIAAgAAgAAACDmBf/9//8AAAAg5gD//f///+EaAgADAAEAAAAAAAAAAAABAAH//wAPAAEAAAAAAAAAAAACAAA3OQEAAAAAAgBWADkEMwNHAAUACwAAExEzESMRIREhESERVmNjAmgBdf6LAcABh/zyAYcBh/zyAYcAAAIAAP/ABAADwAAYADEAAAEhIg4CFwMeAzMhMj4CNwM2LgIjEyMDIwMjJzMnPgM7ARcjIg4CFwczBwNV/VUjPy0cAQEBGi89JQKpJT0vGgEBARwtPyMRpgG/AVwBXgEBFTNOOq4BkA8UCQQBAcEaA8AbLj4k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AkAAgAOAE4AAwABBAkAAwAQACYAAwABBAkABAAQAFwAAwABBAkABQAWABAAAwABBAkABgAQAD4AAwABBAkACgAoAGwARABEAF8ASQBjAG8AbgBzAFYAZQByAHMAaQBvAG4AIAAxAC4AMgBEAEQAXwBJAGMAbwBuAHNERF9JY29ucwBEAEQAXwBJAGMAbwBuAHMAUgBlAGcAdQBsAGEAcgBEAEQAXwBJAGMAbwBuAHMARwBlAG4AZQByAGEAdABlAGQAIABiAHkAIABJAGMAbwBNAG8AbwBuAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==) format('truetype'),
         url(data:application/font-woff;charset=utf-8;base64,d09GRk9UVE8AAAhIAAoAAAAACAAAAQACAAAAAAAAAAAAAAAAAAAAAAAAAABDRkYgAAAA9AAABL4AAAS+uyOppE9TLzIAAAW0AAAAYAAAAGAOsgMvY21hcAAABhQAAABEAAAAROYXAIdnYXNwAAAGWAAAAAgAAAAIAAAAEGhlYWQAAAZgAAAANgAAADYBWCRDaGhlYQAABpgAAAAkAAAAJAf1BFJobXR4AAAGvAAAACAAAAAgGokAVm1heHAAAAbcAAAABgAAAAYACFAAbmFtZQAABuQAAAFCAAABQrhi99hwb3N0AAAIKAAAACAAAAAgAAMAAAEABAQAAQEBCUREX0ljb25zAAECAAEAP/gcAvgbA/gYBB4KAAl2ViX/i4seCgAJdlYl/4uLDAeLSxwEifpUBR0AAACWDx0AAACbER0AAAAJHQAABLUSAAkBAQkRFBkeIygtMkREX0ljb25zRERfSWNvbnN1MjB1RTYwMHVFNjAxdUU2MDJ1RTYwM3VFNjA0dUU2MDUAAAIBiQAGAAgCAAEABAAHADgAsgGBAsUDXwQG/pQO/JQO9x3h+FQVi/gbBe+LBYv9oQUniwWL+BsF+PyLFYv4GwX4CYsFi/2hBfwJiwWL+BsFDvnp+lQV/T+LBS2LPj6LLQiL/T8Fiy3YPumLCPk/iwXpi9jYi+kIi/k/BYvpPtgtiwic/JQV+zuLBYv8VAX7VIs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9xSLBYv8VAVL+JQVaItuqIuuCIuuqKiuiwiui6hui2gIi2hubmiLCPiU/JQV+xSLBYv3lAWLrm6oaIsIaItubotoCIv7lAX7FIsFi/hUBfcUiwWLPAWlr7O2uIsI24vLQ4szCIv7tAUO+pQU+pQViwwKAAAAAwQAAZAABQAAApkCzAAAAI8CmQLMAAAB6wAzAQkAAAAAAAAAAAAAAAAAAAABEAAAAAAAAAAAAAAAAAAAAABAACDmBQPA/8D/wAPAAEAAAAABAAAAAAAAAAAAAAAgAAAAAAACAAAAAwAAABQAAwABAAAAFAAEADAAAAAIAAgAAgAAACDmBf/9//8AAAAg5gD//f///+EaAgADAAEAAAAAAAAAAAABAAH//wAPAAEAAAABAABnFv6NXw889QALBAAAAAAAzwLv4wAAAADPAu/jAAD/wAQzA8AAAAAIAAIAAAAAAAAAAQAAA8D/wAAABIkAAAAABDMAAQAAAAAAAAAAAAAAAAAAAAgAAAAAAgAAAASJAFYEAAAABAAAAAQAAAAEAAAABAAAAAAAUAAACAAAAAAADgCuAAEAAAAAAAEAEAAAAAEAAAAAAAIADgBOAAEAAAAAAAMAEAAmAAEAAAAAAAQAEABcAAEAAAAAAAUAFgAQAAEAAAAAAAYACAA2AAEAAAAAAAoAKABsAAMAAQQJAAEAEAAAAAMAAQQJAAIADgBOAAMAAQQJAAMAEAAmAAMAAQQJAAQAEABcAAMAAQQJAAUAFgAQAAMAAQQJAAYAEAA+AAMAAQQJAAoAKABsAEQARABfAEkAYwBvAG4AcwBWAGUAcgBzAGkAbwBuACAAMQAuADIARABEAF8ASQBjAG8AbgBzRERfSWNvbnMARABEAF8ASQBjAG8AbgBzAFIAZQBnAHUAbABhAHIARABEAF8ASQBjAG8AbgBzAEcAZQBuAGUAcgBhAHQAZQBkACAAYgB5ACAASQBjAG8ATQBvAG8AbgAAAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=) format('woff');
    font-weight: normal;
    font-style: normal;
}

.icon-facebook:before{
    font-family: "DD_Icons" !important;
    content: "\e601";
}
.icon-twitter:before{
    font-family: "DD_Icons" !important;
    content: "\e602";
}
.icon-google-plus:before{
    font-family: "DD_Icons" !important;
    content: "\e603";
}
.icon-feed:before{
    font-family: "DD_Icons" !important;
    content: "\e604";
}
.icon-linkedin:before{
    font-family: "DD_Icons" !important;
    content: "\e605";
}
.icon-DD-Options:before{
    font-family: "DD_Icons" !important;
    content: "\e600";
}

3 个答案:

答案 0 :(得分:1)

这是一个已知问题。显然,IE8在渲染图标字体时遇到问题,因为它不支持同时使用@font-face:before伪元素。您可以在此处阅读有关此问题的更多信息,并在Adam的评论中提供可能的解决方案:

http://andymcfee.com/2012/04/04/icon-fonts-pseudo-elements-and-ie8/

答案 1 :(得分:1)

网络阻止此外部文件被引入(可能是文件类型)或网络策略阻止此作为IE配置。

对于我们为我们的大客户建造的网站而言,这件事发生在我身上。他们的IE9被锁定了。

但是,为了记录,您可以在IE8中使用图标字体。我们一直这样做。在IE8中查看此页面以查看:http://fontawesome.io/whats-new/

我认为链接文章说伪元素和图标字体不能一起工作的原因是因为他试图为实际字母实现图标字体 - 即内容:“A”。

但是,请看FontAwesome实现它们的幕后方式:

<span class="icon-home"></span>

变为:

.icon-home:before {
    content: "\e900";
}

那个\ e900是private use area of Unicode的一部分。这意味着如果.woff或.eot文件被阻止,你会看到,而不是符号。

但是,您可以使用像http://icomoon.io这样的工具来选择要使用的图标,并自定义它以使用与目标图标类似的不同unicode值。

这个页面(http://unicode.johnholtripley.co.uk/all/)证明了这项努力非常有价值。

.icon-home:before {
    content: "\2602";
}
如果字体文件被阻止,

变为。。

答案 2 :(得分:0)

当SVG不受支持时,看起来你有.eot文件用于后备。请参阅此主题以获取所需格式CSS @font-face not working in IE8