[英]Despite IE, @font-face not working in Chrome and FireFox
Sorry, this question might be duplicated, but I couldn't find any answer to my problem. 抱歉,这个问题可能重复了,但我找不到我的问题的任何答案。 implimenting @font-face in css works properly in IE but in FireFox and Chrome has no effect. 在CSS中隐含@ font-face在IE中可以正常工作,但在FireFox和Chrome中无效。 I want to add a non-standard font to my web site, so I put the files Snazanin.ttf and Snaznnbd.ttf to the same directory as css file and added the following code to css: 我想在我的网站上添加非标准字体,因此我将文件Snazanin.ttf和Snaznnbd.ttf放在与css文件相同的目录中,并将以下代码添加到css中:
@font-face{
font-family: MyFont;
src:url('Snazanin.ttf')format('truetype') ;
}
@font-face{
font-family: MyFont;
src:url('Snaznnbd.ttf')format('truetype');
font-weight: bold;
}
and in another css file I have: 在另一个css文件中,我有:
#mainframe{
width:666px;
margin:0px auto 0px auto;
font-family:MyFont;
}
also in the same directory, I have the file .htaccess which contains: 同样在同一目录中,我有文件.htaccess,其中包含:
AddType font/ttf .ttf
as I mentioned earlier, there is no problem with IE but chrome and FireFox fail to show MyFont thanks for answering 正如我之前提到的,IE没问题,但是chrome和FireFox无法显示MyFont,感谢您的回答
I assume it has to do with the browser's support of the filetype. 我认为这与浏览器对文件类型的支持有关。 Here's a few quick references: 以下是一些快速参考:
http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp http://www.w3schools.com/cssref/css3_pr_font-face_rule.asp
http://caniuse.com/ttf http://caniuse.com/ttf
http://caniuse.com/woff http://caniuse.com/woff
http://caniuse.com/eot http://caniuse.com/eot
http://caniuse.com/svg-fonts http://caniuse.com/svg-fonts
You may want to supply multiple font files. 您可能要提供多个字体文件。 As per the w3schools link, a ttf/eot mix should have you covered. 根据w3schools链接,应该涵盖ttf / eot组合。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.