How to properly render @font-face in Firefox?

送分小仙女□ 提交于 2019-12-22 10:26:37

问题


I am attempting to use @font-face for Chrome, Safari, Firefox, and IE. For IE i am not even sure what to do but for the other browsers I want the @font-face part to work.

Here's what I have used:

  @font-face {
  font-family: "Handwriter";
  src: url("/folder/Font-Regular.otf");
  }

And then I also tried:

 @font-face {
 font-family: "Handwriter";
 src: url("http://www.domain.com/folder/Font-Regular.otf");
 }

Using either of these will render it properly in Chrome and Safari but not in Firefox. The funny thing is that if I use Firebug and go to the CSS file and rewrite the name again then it renders it. In addition, the font file is on my server and I am rending this on the same domain. So not sure what is going wrong here.


回答1:


try this (with your custom fonts). Remember the format is important:

@font-face {
  font-family: 'WebFont';
  src: url('myfont.woff') format('woff'),  /* Firefox 3.6+, IE9+, Chrome 6+, Safari 5.1+*/
       url('myfont.ttf') format('truetype');  /* Safari 3—5, Chrome4+, Firefox 3.5, Opera 10+ */
}

source: css3please




回答2:


It's not an advertisement :D

I succefully use http://www.fontsquirrel.com/fontface generator :) If You have z ttf file the rest is a piece of cake :)



来源:https://stackoverflow.com/questions/13504780/how-to-properly-render-font-face-in-firefox

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!