【问题标题】:font-face fonts not working when hosting online在线托管时字体字体不起作用
【发布时间】:2021-04-29 22:47:00
【问题描述】:

我正在使用 font-face 字体,当我将它上传到测试服务器时,它没有显示,也没有显示任何错误,所以也无法找出问题所在,谁能帮我弄清楚为什么它没有显示?

我已将字体上传到根 html 文件旁边的根目录

   <style>
      @font-face {
        font-family: 'Hanson';
        src: url('Hanson-Bold.ttf');
        src: url('Hanson-Bold.otf');
      }
      @font-face {
        font-family: 'vag';
        src: url('VAGRoundedBT-Regular.otf');
      }

      @font-face {
        font-family: 'Vagbold';
        src: url('VAGRoundedStd-Bold.otf');
  
      }

      @font-face {
        font-family: 'Vaglight';
        src: url('VAGRoundedStd-Light.ttf');
        src: url('VAGRoundedStd-Light.otf');
  
      }
      body {
        font-family: 'vag';
      }

【问题讨论】:

  • 您能否提供一个可重现的代码 sn-p 和指向您遇到此问题的页面的链接?此 sn-p 不包含任何导致您的问题的原因。

标签: html css fonts font-face typography


【解决方案1】:

您可能需要修改 .htaccess 文件,添加以下行:
AddType application/vnd.ms-fontobject eot
AddType font/opentype otf
AddType font/truetype ttf
AddType application/x-font-woff woff
还要确保该文件在那里并且名称完全相同(区分大小写)

【讨论】:

    猜你喜欢
    • 2014-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-28
    • 2022-08-06
    • 2015-08-10
    • 2020-11-07
    • 1970-01-01
    相关资源
    最近更新 更多