【发布时间】:2017-04-10 15:27:49
【问题描述】:
这是我的代码,它在台式机和平板电脑上运行良好,但在移动设备上却不行。是代码还是某些字体在移动设备上不起作用
@font-face {
font-family: 'Out';
src: url('http://location/Outstanding.otf');
}
【问题讨论】:
-
浏览器特定问题
这是我的代码,它在台式机和平板电脑上运行良好,但在移动设备上却不行。是代码还是某些字体在移动设备上不起作用
@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)
【讨论】:
您还没有包含(假设您有)所有必要的字体文件:
@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。
【讨论】: