Css 为什么字体不是';t在移动设备上加载
我不明白为什么我的字体不能在手机上加载,但它们在桌面上运行良好。我最初是在标题中内联添加字体的(严格地说是针对我工作的环境)。我现在将字体作为单独的scss文件导入,但以下是我的导入:Css 为什么字体不是';t在移动设备上加载,css,import,font-face,Css,Import,Font Face,我不明白为什么我的字体不能在手机上加载,但它们在桌面上运行良好。我最初是在标题中内联添加字体的(严格地说是针对我工作的环境)。我现在将字体作为单独的scss文件导入,但以下是我的导入: @font-face { font-family: 'Regular'; font-weight: 400; src: url("/../fontPath/../Regular-Regular.otf") format("opentype") url("/../fontPath/../R
@font-face {
font-family: 'Regular';
font-weight: 400;
src: url("/../fontPath/../Regular-Regular.otf") format("opentype")
url("/../fontPath/../Regular-Regular.woff2") format("woff2"),
url("/../fontPath/../Regular-Regular.woff") format("woff"),
url("/../fontPath/../Regular-Regular.eot") format("eot");
}
@font-face {
font-family: 'Regular';
font-weight: 600;
src: url("/../fontPath/../Regular-Semibold.otf") format("opentype")
url("/../fontPath/../Regular-Semibold.woff2") format("woff2"),
url("/../fontPath/../Regular-Semibold.woff") format("woff"),
url("/../fontPath/../Regular-Semibold.eot") format("eot");
}
@font-face {
font-family: 'Regular';
font-weight: 600;
font-style: italic;
src: url("/../fontPath/../Regular-SemiboldItalic.otf") format("opentype")
url("/../fontPath/../Regular-SemiboldItalic.woff2") format("woff2"),
url("/../fontPath/../Regular-SemiboldItalic.woff") format("woff"),
url("/../fontPath/../Regular-SemiboldItalic.eot") format("eot");
}
@font-face {
font-family: 'Regular';
font-weight: 800;
src: url("/../fontPath/../Regular-BlackItalic.otf") format("opentype")
url("/../fontPath/../Regular-BlackItalic.woff2") format("woff2"),
url("/../fontPath/../Regular-BlackItalic.woff") format("woff"),
url("/../fontPath/../Regular-BlackItalic.eot") format("eot");
}
html {
font-family: 'Regular', sans-serif;
font-style: italic;
}
看起来您缺少可在移动设备上使用的字体 您需要truetype(ttf)才能在Android和iOS上正常工作:
@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 */
}
您可以在此处查看更多详细信息:
干杯我觉得有点傻,但我发现问题是我在otf文件后漏掉了一个逗号