Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css Google字体(Lato)未在Google Chrome上呈现_Css_Google Chrome_Fonts_Sass - Fatal编程技术网

Css Google字体(Lato)未在Google Chrome上呈现

Css Google字体(Lato)未在Google Chrome上呈现,css,google-chrome,fonts,sass,Css,Google Chrome,Fonts,Sass,当我在Google Chrome中加载网站时,使用Lato字体的文本不会随机显示(在modals或导航标题链接中)。在我悬停样式链接或重新触发Inspector中的任何CSS属性后,文本将变为可见 我尝试过不同的解决方案,如,但对我无效 我正在本地加载字体。这是我的字体SCS: // Lato // // The Lato font in a Sass format to be imported easily in any // project. // sass-lint:disable no

当我在Google Chrome中加载网站时,使用Lato字体的文本不会随机显示(在modals或导航标题链接中)。在我悬停样式链接或重新触发Inspector中的任何CSS属性后,文本将变为可见

我尝试过不同的解决方案,如,但对我无效

我正在本地加载字体。这是我的字体SCS:

// Lato
//
// The Lato font in a Sass format to be imported easily in any 
// project.
// sass-lint:disable no-duplicate-properties

$fontface-src: '../assets/fonts' !default;

// Regular
@font-face {
    font-family: 'Lato';
    src: 
        url($fontface-src + '/lato/Lato-Regular.svg') 
format('svg'),
        url($fontface-src + '/lato/Lato-Regular.ttf') 
format('truetype'),
        url($fontface-src + '/lato/Lato-Regular.woff') 
format('woff'),
        url($fontface-src + '/lato/Lato-Regular.eot'),
        url($fontface-src + '/lato/Lato-Regular.eot?#iefix') 
format('embedded-opentype');
    font-weight: normal;
    font-weight: 400;
    font-style: normal;
}

// Light
@font-face {
    font-family: 'Lato';
    src:
        url($fontface-src + '/lato/Lato-Light.svg') format('svg'),
        url($fontface-src + '/lato/Lato-Light.ttf') 
format('truetype'),
        url($fontface-src + '/lato/Lato-Light.woff') 
format('woff'),
        url($fontface-src + '/lato/Lato-Light.eot'),
        url($fontface-src + '/lato/Lato-Light.eot?#iefix') 
format('embedded-opentype');
    font-weight: normal;
    font-weight: 300;
    font-style: normal;
}

我很确定这和不同字体文件的顺序有关。浏览器选择它支持的第一种文件格式,而SVG非常老派,因此您可能会出现这种奇怪的行为

检查以下答案:

Paul Irish建议加载字体的“防弹”方法是 首先渲染EOT,然后是WOFF、TTF,最后是SVG


你能举个例子吗?