IE 中的 CSS 自定义字体在刷新时发生变化
我有一个在 CSS 中使用的自定义字体,转换为 EOT、WOFF 和 TTF,以便在所有浏览器中工作
。除了在 IE 中之外,它工作得很好。它确实有效,但在我的 IE8 中,当我刷新时,字体的高度似乎发生了变化,这导致所有间距都消失了......任何人都可以看到问题或确认这不仅仅是我的浏览器吗?
I have got a custom font that i am using in CSS, converted in to EOT, WOFF and TTF to work in all browsers
It works perfectly except in, yes you guessed it, IE. It does work but in my IE8 when i refresh the font seems to change in height which throws all the spacing out... Can anyone see the problem or confirm that its not just my browser ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我和我的同事正在摸索同样的错误。我们的环境在 Facebook 框架中运行。第一次加载页面时(缓存为空),字体渲染得很好,但经过简单的刷新后,字体变成了 Arial 并带有我们自定义字体的字距调整等。该错误在 HTTP 和 HTTPS 上也有所不同,在 HTTP 上它可以正常工作。
我们开始尝试各种博客文章和这个帖子中描述的修复程序,但我们没有运气。我当时就傻眼了,准备用图片来代替文字。
然后我在 IE 中关闭缓存进行测试,问题就消失了。因此我们尝试在标头级别关闭缓存。不漂亮。但它奏效了。无缓存标头仅在字体上设置,并且它的作用就像一个魅力。
My and my coworkers were fumbling over the same bug. Our environment ran in a Facebook frame. Upon first loading the page (with empty cache), the fonts rendered fine, but after a simple refresh, the fonts turned into Arial with our custom font's kerning, or something. The bug also differed from HTTP to HTTPS, where on HTTP it would work just fine.
We started messing around with the fixes described in various blog posts and this thread but we had no luck. I was dumbfounded and was ready to replace the text with images.
I then tested with caching turned off in IE, and the problem went away. So we tried turning off cache at header level. Not pretty. But it worked. The no-cache header was only set on the fonts, and it worked like a charm.
这对我有用。将 id 放入
文档准备就绪中,使用纯 JavaScript 或 jQuery,如下所示。
This work for me. Put an id in
<link>
On document ready, use pure javascript or jQuery like this.