html - 移动 Firefox 和 Chrome 无法识别 @font-face
问题描述
我在我的网站上使用了一种特定的字体。Firefox 和 Chrome 在 PC 上识别它(本地和服务器),但在移动设备上识别它(Firefox 和 Chrome)。我在我的 CSS 文件中使用 @font-face。
我在服务器上上传了字体。我不知道该尝试什么,因为它确实可以在计算机上运行。非常感谢任何帮助。
这是我的 HTML:
<div class="welcome">WELCOME</div><div class="home">HOME</div>
这是我的CSS:
@font-face {
font-family: 'typographicaregular';
src: url('../fonts/typographica.regular-webfont.woff') format('woff2'),
url('../fonts/typographica.regular-webfont.woff2') format('woff');
font-weight: normal;
font-style: normal;}
.welcome {
width: 47%;
padding: 0;
margin: 0 auto;
font-family: 'typographicaregular', sans-serif;
font-size: .7em;
letter-spacing: 26px;
text-align: center;
color: #004391;
}
.home {
width: 85%;
padding: 0;
margin: -40px auto 0;
font-family: 'typographicaregular', sans-serif;
letter-spacing: 12px;
font-weight: bold;
font-size: 1.6em;
text-align: center;
color: #004391;
}
它应该在我的 Android 手机和 iPad 上显示实际字体,而不是通用的 san-serif 字体。
解决方案
这似乎与以下内容重复:@font-face Not Working in Chrome for Android
问题可能与您的font-family
声明有关(我无法确定,因为您尚未发布该部分)。例如,如果你有这个:
font-family: fghjkjh, 'jump_startregular', sans-serif;
...Android 版 Chrome 会简单地假装 fghjkjh 已安装(但实际上使用默认的 Android 字体)并忽略其他所有内容。(不确定这是错误还是功能。)
在这种情况下,解决方案是将“jump_startregular”移到前面 - 并可能将local
源添加到@font-face
块中,这可能会导致其他旧浏览器出现问题。
“从上面提到的链接中逐字逐句”
如果这不起作用,我建议您改用谷歌字体。
推荐阅读
- angular - ESLint 抱怨空的构造函数和 ngOnInit-implementation
- python - 使用 Matplotlib 鼠标事件获取图像的 rgba 值
- css - Ampersand Sass 选择器不适用于样式化组件中的同级选择器
- docker - Docker 运行命令抛出和错误消息
- javascript - 无法使用js设置html表格单元格的rowspan属性
- java - 按转换按钮(使用 API)时,货币转换器应用程序崩溃
- typescript - 打字稿检查数组值在 enum1 或 enum 2 但不是两者
- javascript - 具有“表单控制”类的 PrestaShop 输入不起作用
- javascript - 无法在字符串上创建属性“onload”
- python - pygame:我想计算玩家精灵和敌人1之间的距离