字体系列未应用于移动设备

新手上路,请多包涵

我的 css 中的字体系列属性有问题。我有一个标题,我想使用特定字体设置样式。我正在使用 @fontface 。在我的桌面上它工作正常,但在 iPhoneiPad 我得到一些标准字体(我认为它可能是时间但我不确定)。我做了一些研究并尝试了不同的格式 otf ttf 等…但仍然无法正常工作。最后,受够了,我尝试将我的 css 上的字体更改为其他系统字体,但手机仍然无法识别它们。基本上它只使用一种字体。以下是桌面上的几个字体示例:

在此处输入图像描述

前三个图像是我在桌面版本上应用的不同字体系列。有系统字体、谷歌字体和使用 @fontface 的自定义字体。所有的工作。

第四张图片是在 iPhoneiPad 上显示的每种字体。总是一样的。到底发生了什么?任何建议表示赞赏。

我的自定义字体代码是:

 @font-face {font-family: QuaestorSans;
          src:  url("fonts/QuaestorSans-Rg.otf") format("opentype"),
                url("fonts/QuaestorSans.ttf") format("opentype");
}

.title{
  font-family: QuaestorSans;
  font-size: 2em;
  letter-spacing: 1.4px;
}

html

alice soyer 人间天空

有一个淡入淡出字母的小动画,但我不认为这会干扰字体系列(并且仅在移动设备上?)。

如果你想查看网站,它是 alicesoyer.com

字体系列只有一个规则,但如果您在桌面和移动设备上测试网站(我现在正在 iPhone 和 iPad 上测试),您会看到不同的系列。谢谢

原文由 Paul 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 256
2 个回答

我想在 fontsquirel 旁边添加@Venu Madhav 和@JezEmery 的答案,你也可以试试 Transfonter

对于代码,如果您在网络上使用多种字体,请将每种字体包含在

@font-face {
  //font number 1 here
}
@font-face {
 // font number 2 here and so on
}

因为我确实尝试过

@font-face {
font-family: 'LatoRegular';
src: url('../fonts/LatoRegular.eot');
src: url('../fonts/LatoRegular.eot') format('embedded-opentype'),
     url('../fonts/LatoRegular.woff2') format('woff2'),
     url('../fonts/LatoRegular.woff') format('woff'),
     url('../fonts/LatoRegular.ttf') format('truetype'),
     url('../fonts/LatoRegular.svg#LatoRegular') format('svg');

font-family: 'font 2';
src: url('../fonts/LatoRegular.eot');
src: url('../fonts/LatoRegular.eot') format('embedded-opentype'),
     url('../fonts/LatoRegular.woff2') format('woff2'),
     url('../fonts/LatoRegular.woff') format('woff'),
     url('../fonts/LatoRegular.ttf') format('truetype'),
     url('../fonts/LatoRegular.svg#LatoRegular') format('svg');

font-family: 'font 3';
src: url('../fonts/LatoRegular.eot');
src: url('../fonts/LatoRegular.eot') format('embedded-opentype'),
     url('../fonts/LatoRegular.woff2') format('woff2'),
     url('../fonts/LatoRegular.woff') format('woff'),
     url('../fonts/LatoRegular.ttf') format('truetype'),
     url('../fonts/LatoRegular.svg#LatoRegular') format('svg');

/* ----- so on */
}

为了节省代码行,是的,它仍然可以在桌面上运行,但在移动设备上失败了。

原文由 ailia 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题