Vat*_*ato 8 html css fonts icons preload
我正在尝试使用谷歌灯塔优化我的网页。
该报告说在导入 Material Design 图标的链接上使用 rel=preloads。
我尝试使用语法预加载它们。
<link rel="preload" href="" as="style" crossorigin>
Run Code Online (Sandbox Code Playgroud)
我还尝试使用 as 字体进行预加载。类型为 woff、woff2 和 ttf。它们似乎都不起作用。我还添加了 crossorigin 和 crossorigin="anonymous" 但仍然没有进展。
这些是我的实际链接。我想导入它们。
<link rel="preload" href="https://cdnjs.cloudflare.com/ajax/libs/material-design-iconic-font/2.2.0/css/material-design-iconic-font.min.css" as="style">
<link rel="preload" href="https://fonts.googleapis.com/icon?family=Material+Icons" as="font" type="font/woff" crossorigin>
Run Code Online (Sandbox Code Playgroud)
应该如何将这些链接与预加载一起使用?
CES*_*SCO -1
<link rel="preload" href="https://fonts.gstatic.com/s/materialicons/v41/flUhRq6tzZclQEJ-Vdg-IuiaDsNZ.ttf" as="font" type="font/ttf" crossorigin="anonymous">
<style>
@font-face {
font-family: 'Material Icons';
font-style: normal;
font-weight: 400;
}
.material-icons {
font-family: 'Material Icons';
font-weight: normal;
font-style: normal;
font-size: 24px;
line-height: 1;
letter-spacing: normal;
text-transform: none;
display: inline-block;
white-space: nowrap;
word-wrap: normal;
direction: ltr;
}
</style>
Run Code Online (Sandbox Code Playgroud)