@font-face 在 Firefox 中不起作用(但完全相同的代码在另一个网站上有效)
我有两个网站使用相同的 @font-face 代码。字体文件托管在各自的站点上,并且路径正确。
一种有效,一种无效。 (当然,它适用于我的个人网站,而不适用于客户!)
我真的很感激对此的一些新观点!
适用范围:
CSS 文件:http://365.example.com/index.php?css=photos/style。 v.1275845154
相关代码:
@font-face {
font-family: 'JournalRegular';
src: url('./themes/fonts/journal.eot');
src: local('Journal Regular'), local('Journal'), url('./themes/fonts/journal.ttf') format('truetype');
}
body{
background: url("http://labs.example.com/personal/library/images/BG.jpg");
height: 100%;
width: 100%;
margin: 0;
padding: 0;
font-family: 'JournalRegular', Georgia, 'Times New Roman', Times, sans-serif;
color: #999;
}
不起作用的地方:
站点: http://www.v.1275845154 example.org/
CSS 文件: http:// www.example.org/wp-content/themes/theme/style.css
相关代码:
@font-face {
font-family: 'JournalRegular';
src: url('http://example.org/wp-content/themes/theme/fonts/journal.eot');
src: local('Journal Regular'), local('Journal'), url('http://example.org/wp-content/themes/theme/fonts/journal.ttf') format('truetype');
}
.title h1{
float:left;
background:url(images/blt-ttl1?.png) no-repeat 0 4px;
margin:0px 0 5px;
/* padding:8px 0 8px 34px; */
color:#bd5f01;
letter-spacing: .5pt
font:24px/26px 'JournalRegular', Georgia, 'Times New Roman', Times, serif;
}
任何帮助将不胜感激!
I have two sites using the same exact code for @font-face. The font files are hosted on the respective sites and the paths are correct.
One works, one doesn't. (And of course it works on my personal site and not the clients!)
I'd really appreciate some fresh perspective on this!
Where it WORKS:
The site: http://example.com/
The CSS file: http://365.example.com/index.php?css=photos/style.v.1275845154
The relevant code:
@font-face {
font-family: 'JournalRegular';
src: url('./themes/fonts/journal.eot');
src: local('Journal Regular'), local('Journal'), url('./themes/fonts/journal.ttf') format('truetype');
}
body{
background: url("http://labs.example.com/personal/library/images/BG.jpg");
height: 100%;
width: 100%;
margin: 0;
padding: 0;
font-family: 'JournalRegular', Georgia, 'Times New Roman', Times, sans-serif;
color: #999;
}
Where it DOESN'T WORK:
The site: http://www.example.org/
The CSS file: http://www.example.org/wp-content/themes/theme/style.css
The relevant code:
@font-face {
font-family: 'JournalRegular';
src: url('http://example.org/wp-content/themes/theme/fonts/journal.eot');
src: local('Journal Regular'), local('Journal'), url('http://example.org/wp-content/themes/theme/fonts/journal.ttf') format('truetype');
}
.title h1{
float:left;
background:url(images/blt-ttl1?.png) no-repeat 0 4px;
margin:0px 0 5px;
/* padding:8px 0 8px 34px; */
color:#bd5f01;
letter-spacing: .5pt
font:24px/26px 'JournalRegular', Georgia, 'Times New Roman', Times, serif;
}
Any help would be so greatly appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个问题的最终解决方案是:
将代码复制到 .htaccess 文件中,上传它,然后就完成了:firefox 将显示您的 @font-face 字体。
希望它对每个人都有效!
the ultimate solution to this problem is:
Copy the code into the .htaccess file, upload it, and your're done: firefox will show your @font-face fonts.
Hope it works for everyone!
默认情况下,firefox 只接受 font-face 的相对链接。链接
使用 HTTP 访问控制或相关链接
firefox accepts only relative links for font-face by default.. link
Use HTTP access control or relative links
字体嵌入,即
@font-face
需要在每个域的基础上创建字体文件。这是因为某些字体可能存在版权问题。
Font-embedding, that is, the
@font-face
requires the font file to be created on a per-domain basis.That's because the some fonts might have copyright issues.