【问题标题】:@font-face not working on firefox@font-face 不能在 Firefox 上工作
【发布时间】:2012-07-25 09:09:56
【问题描述】:

我已经搜索了所有地方,原因是字体在 Firefox 中无法正常工作。我找到了几个不同的答案,但似乎没有一个可以解决问题。如果有人能给我一些提示,那就太好了。

CSS 代码:

@font-face
{
    font-family:Viking-Normal;
    src: url('../fonts/VIKING.eot') format("opentype"), url('../fonts/VIKING.ttf') format("truetype");
}

div#header
{
    font-family:Viking-Normal !important;
    font-size:58px;
    text-align:center;
    width:780px;
    height:150px;
    background:#0078A8;
    margin-left:auto;
    margin-right:auto;
}

【问题讨论】:

    标签: firefox css font-face


    【解决方案1】:

    了解您已经尝试过的内容会有所帮助,但是通过查看您的代码会想到三件事:

    1. 字体系列名称​​应该在单引号或双引号之间。

      例如,

      font-family: 'Viking-Normal';
      


    2. 你的字体路径可能有误,你可以直接从浏览器访问它吗?


    3. 您的浏览器支持的字体文件可能已损坏或缺失。我使用 font squirrel to generate 所需的 CSS 和字体文件。

      您只需要上传您的字体文件,它会弹出一个 .zip 文件,其中包含一个带有您的字体的演示、一个 css 就绪文件以及更好的跨浏览器支持所需的格式。

      例如,

      @font-face {
          font-family: 'VikingRegular';
          src: url('viking-webfont.eot');
          src: url('viking-webfont.eot?#iefix') format('embedded-opentype'),
               url('viking-webfont.woff') format('woff'),
               url('viking-webfont.ttf') format('truetype'),
               url('viking-webfont.svg#DearestRegular') format('svg');
          font-weight: normal;
          font-style: normal;
      }
      

    【讨论】:

    • 感谢 Zuul,我修改了松鼠字体,我知道它可以在所有浏览器上运行。 CSS:@font-face { 字体系列:'VikingRegular'; src: url('../fonts/VIKING.eot'); src: url('../fonts/VIKING.eot?#iefix') 格式('embedded-opentype'),url('../fonts/VIKING.ttf') 格式('truetype'),font-weight : 普通的;字体样式:正常; }
    • @MatthewBranch 很高兴我能帮上忙! :)
    猜你喜欢
    • 1970-01-01
    • 2012-03-27
    • 1970-01-01
    • 2014-02-15
    • 1970-01-01
    • 2011-06-15
    • 2012-08-19
    • 2014-10-12
    • 2019-01-06
    相关资源
    最近更新 更多