@ Font-face无法在移动设备上运行

时间:2017-04-10 15:27:50

标签: html css font-face

在这里,我的代码在台式机和平板电脑上运行得非常好,但在移动设备上则不行。是代码还是某些字体无法在移动设备上运行

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

2 个答案:

答案 0 :(得分:13)

您需要将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/
希望能帮助到你, 欢呼声。

如果您需要转换字体,则需要 https://www.fontsquirrel.com/tools/webfont-generator

答案 1 :(得分:0)

您还没有包含(假设您拥有它们)所有必需的字体文件:

@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。

相关问题