@font-face 不显示在 Internet Explorer 上

发布于 2024-12-28 00:24:45 字数 911 浏览 3 评论 0原文

我目前正在使用防弹语法和从 Font-Squirrel 转换的字体作为字体 www.runningwith Purpose.org.nz (html 中的内联 css 字体 - 工作) www.runningwith Purpose.org.nz/broken (css 文件中的字体 - 不起作用) 。 这两种方法在 IE 以外的浏览器上都可以很好地显示字体,有时会显示部分或全部字体,有时则根本不显示(但通常根本不显示)。 我尝试使用“笑脸”语法来处理 htaccess 文件,但都不起作用。 不过我确实设法修复了它,但将字体 css 内联到 html 文件中。 这没关系,但我想知道为什么我似乎无法让它工作,因为许多其他人在 css 文件中都有 @font-face 声明,这会更干净,并且它曾经对我来说工作得很好,但事实并非如此。

考虑到没有其他现有帮助起作用,任何有关如何使其工作的建议都会很棒。

使用的 @font-face 声明之一

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

I am currently using the bulletproof syntax and converted fonts from Font-Squirrel for the fonts on
www.runningwithpurpose.org.nz (fonts inline css in the html - working)
www.runningwithpurpose.org.nz/broken (fonts in css file - not working)
.
The both methods display fontes fine on browsers other than IE which sometimes will display some or all the fonts and other times not at all (but usually not at all).
I have tried playing around with the htaccess file, using the 'smiley' syntax but neither worked.
However I did manage to fix it but putting the font css inline in the html file.
This is ok but I was wondering why I seem to be unable to get it working as many other people have the @font-face declarations in the css file which would be much cleaner and it used to work fine for me but doesn't.

Any suggestions on how to get this working would be great, considering no other existing help has worked.

One of the @font-face declarations used

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

鹿! 2025-01-04 00:24:45

你尝试过使用 Google webfont 吗?,我曾经使用 fontface 但发现 Google 字体的实现要容易一百万倍,而且用户不必每次都从你的服务器下载字体,它直接来自 Google 。
http://www.google.com/webfonts

Have you tried using Google webfont instead ?, I used to used fontface but found that Google font are a million times easier to implement, plus the user doesn't have to download the font off your server each time, it just comes straight from Google.
http://www.google.com/webfonts

彼岸花似海 2025-01-04 00:24:45

正如我的问题中所述,我当时可以通过将 @font-face 声明内联到 html 中来修复它。
但现在 IE 似乎决定自行修复并让我在 CSS 中声明 @font-faces 。

As stated in my question I was able to fix it at the time by putting the @font-face declarations inline in the html.
But now IE seems to have decided to fix itself and let me declare @font-faces in the CSS.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文