【问题标题】:@font-face still not working in FireFox. Issue with type of font?@font-face 仍然无法在 FireFox 中工作。字体类型有问题?
【发布时间】:2013-12-14 13:43:28
【问题描述】:

我知道有人问过这个问题here,但我已经尝试了提到的解决方案,但没有任何影响。

我的 CSS 声明如下:

@font-face { 
      font-family: gillsans; 
      src: url('gillsans.TTF'); 
    } 

这适用于 Chrome,但不适用于 FireFox。

奇怪的是,我有另一个网站使用完全相同的声明,但字体不同,它工作正常:

@font-face
{
    font-family: bebas;
    src: url('bebas.TTF');
}

这可能与实际的字体文件有关吗?

我也尝试按照建议修改我的 .htaccess 文件:

AddType font/ttf .ttf
AddType font/eot .eot
AddType font/otf .otf
AddType font/woff .woff

<FilesMatch "\.(ttf|otf|eot)$">
    <IfModule mod_headers.c>
        Header set Access-Control-Allow-Origin "*"
    </IfModule>
</FilesMatch>

在 FireFox 中再次没有结果。

我尝试将.TTF 更改为.tff 并提供文件的绝对路径,但仍然没有。

谁能推荐一些我可以尝试的东西?

唯一可能的情况是该站点正在开发中,因此正在使用临时 URL,但我不明白这会如何影响它。

【问题讨论】:

    标签: .htaccess css firefox fonts


    【解决方案1】:

    尝试其他字体类型,如 eot、woff 和 svg。要转换,您可以使用http://www.onlinefontconverter.com/

    然后在您的样式或 css 文件中尝试此代码:

    <style type="text/css">
    @font-face {
        font-family:'bebas';
        src:url('bebas.eot');/*IE9 or later*/
        src:local('bebas'),/*check for font installation*/
            local('b ebas'),/*check for font installation in some browsers like Safari*/
            url('bebas.eot?#iefix') format('embedded-opentype'),/*hack for IE8 or earlier*/
            url('bebas.woff') format('woff'),/*new browsers*/
            url('bebas.ttf') format('truetype'),/*all browsers excpet IE*/
            url('bebas.svg#bebas') format('svg');/*old iOs*/
    }
    .bebas-ft{
        font-family:bebas, Tahoma, Geneva, sans-serif;
    }
    </style>
    

    也不要为了这么简单的事情修改你的 .htaccess 文件!

    【讨论】:

      【解决方案2】:

      所以我下载了另一个版本的 Gill Sans(仍然是 ttf)并替换了我拥有的修复它的版本。很奇怪。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2023-03-24
        • 1970-01-01
        • 2012-08-08
        • 2015-12-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多