html - @Font-face 不能在手机上工作

标签 html css font-face

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

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

最佳答案

您需要将所有需要的 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 )

关于html - @Font-face 不能在手机上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43327227/

相关文章:

css - 文本输入中的不同字体渲染?

html - 如何使用 Tailwind CSS 在模态框上显示下拉菜单

javascript - Bootstrap 3 旋转木马坏了

jquery - 使用 Bootstrap 垂直居中高度未知的 div

html - 将 <a> 放在父元素 <p> 的底部

html - 直接在 CSS 中嵌入自定义字体

css - 如何更改 Foundry Sterling Bold 的正常字体?

html - 控制一行 flex 盒子的高度扩展

html - 被 CSS 隐藏的元素仍然占用页面空间-如何设置显示 : none conditionally?

css - 在reactJS中悬停时更改父组件背景