【问题标题】:CSS: Font is not displayed correctly in FirefoxCSS:字体在 Firefox 中无法正确显示
【发布时间】:2022-01-21 03:04:31
【问题描述】:

我将一种字体集成到我的网络项目中。 CSS代码来了:

@font-face {

font-family: 'vladimirscriptefregular';

src: url('fonts/vladimirscriptef-webfont.eot');

src: url('fonts/vladimirscriptef-webfont.eot?#iefix') format('embedded-opentype'),

     url('fonts/vladimirscriptef-webfont.woff') format('woff'),

     url('fonts/vladimirscriptef-webfont.ttf') format('truetype'),

     url('fonts/vladimirscriptef-webfont.svg#vladimirscriptefregular') format('svg');

font-weight: normal;

font-style: normal;

}

我的问题是字体没有在 Firefox 中显示 - 而是显示 Times New Roman。在所有其他浏览器中,字体显示正确。

有人看到我的代码中缺少什么吗?

【问题讨论】:

  • 您的文件的 woff 版本是否已损坏或未正确加载?
  • @pete:我不知道,我该如何检查?

标签: css fonts


【解决方案1】:

试试下面的代码:

    @font-face {

    font-family: 'vladimirscriptefregular';
   -moz-font-family:'vladimirscriptefregular';

    src: url('fonts/vladimirscriptef-webfont.eot');

    src: url('fonts/vladimirscriptef-webfont.eot?#iefix') format('embedded-opentype'),

         url('fonts/vladimirscriptef-webfont.woff') format('woff'),

         url('fonts/vladimirscriptef-webfont.ttf') format('truetype'),

         url('fonts/vladimirscriptef-webfont.svg#vladimirscriptefregular') format('svg');

    font-weight: normal;
   -moz-font-weight:normal

    font-style: normal;
    -moz-font-style:normal

    }

【讨论】:

  • 谢谢你的建议,但还是不行
【解决方案2】:

Firefox 有一个可以在其白名单中使用的字体列表。

  1. 在地址栏输入“about:config”即可访问。
  2. 然后搜索“font.system.whitelist”。
  3. 在此处添加您的字体名称,该名称必须存在于字体文件夹中。

对于 Windows,默认位置是“C:\Windows\Fonts”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-25
    • 1970-01-01
    • 2018-05-19
    • 2015-12-30
    • 2023-01-28
    • 2015-03-18
    • 2014-08-20
    相关资源
    最近更新 更多