【问题标题】:@Font-face not working on mobile@Font-face 无法在移动设备上运行
【发布时间】:2017-04-10 15:27:49
【问题描述】:

这是我的代码,它在台式机和平板电脑上运行良好,但在移动设备上却不行。是代码还是某些字体在移动设备上不起作用

@font-face {
    font-family: 'Out';
    src: url('http://location/Outstanding.otf');
}

【问题讨论】:

  • 浏览器特定问题

标签: html css font-face


【解决方案1】:

您需要将所需的所有src 添加到@font-face,如下例所示:

@font-face {
  font-family: 'MyWebFont';
  src: url('webfont.eot'); /* IE9 Compat Modes */
  src: url('webfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('webfont.woff2') format('woff2'), /* Super Modern Browsers */
       url('webfont.woff') format('woff'), /* Pretty Modern Browsers */
       url('webfont.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('webfont.svg#svgFontName') format('svg'); /* Legacy iOS */
}

来源https://css-tricks.com/snippets/css/using-font-face/
希望能帮助到你, 干杯。

(如果你需要转换你需要的字体 font-generator)

【讨论】:

    【解决方案2】:

    您还没有包含(假设您有)所有必要的字体文件:

    @font-face {
      font-family: 'Out';
      src: url('out.eot'); /* IE9 Compat Modes */
      src: url('out.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
           url('out.woff2') format('woff2'), /* Super Modern Browsers */
           url('out.woff') format('woff'), /* Pretty Modern Browsers */
           url('out.ttf')  format('truetype'), /* Safari, Android, iOS */
           url('out.svg#svgFontName') format('svg'); /* Legacy iOS */
    }
    

    所以 Safari/IOS 等缺少 *.ttf。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-19
      • 2014-08-30
      • 2017-01-28
      • 2016-08-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多