gpt4 book ai didi

css - firefox 不会使用 font-face 属性将字体加载到本地主机

转载 作者:行者123 更新时间:2023-11-28 09:28:31 25 4
gpt4 key购买 nike

我在我的本地主机上使用 CSS3 font-face 属性,并在我的网站上托管了一种字体以加载到本地网页上。它在 IE 和 Chrome 上可以正常工作,但在 Firefox 中不能。奇怪的是,当我使用本地 URL 时,它也适用于 Firefox。

//Works with local URLs like http://localhost/repo/BMitra/BMitra.*
@font-face {
font-family: "BMitra";
src: url("http://fonts.gexek.com/repo/BMitra/BMitra.eot");
src: local("☺"),
url("http://fonts.gexek.com/repo/BMitra/BMitra.woff") format("woff"),
url("http://fonts.gexek.com/repo/BMitra/BMitra.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}

我认为在本地主机上工作可能是问题所在,但我发现 Google 字体在本地主机上也能正常工作。

您可以在您的 Firefox 和(Chrome 或 IE)浏览器上看到这个 fiddle 来演示我的意思。
http://jsfiddle.net/66QE3/1/

我错过了什么?

最佳答案

Firefox 错误控制台显示:

downloadable font: download failed (font-family: "BMitra" style:normal 
weight:normal stretch:normal src index:1): bad URI or cross-site access
not allowed
source: http://fonts.gexek.com/repo/BMitra/BMitra.woff

要使用来自不同域的可下载字体,托管该字体的服务器应具有允许跨站点访问的设置,请参阅 HTTP access control (CORS) .

关于css - firefox 不会使用 font-face 属性将字体加载到本地主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14278902/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com