【问题标题】:Minimize google font request最小化谷歌字体请求
【发布时间】:2016-12-06 09:50:50
【问题描述】:

我的主页有以下链接,我需要针对性能问题对此提出共同请求。

<link href='https://fonts.googleapis.com/css?family=Arvo:400,700' rel='stylesheet' type='text/css' />
    <link href='http://fonts.googleapis.com/css?family=Roboto:400,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'/>
    <link href='http://fonts.googleapis.com/css?family=Lato:300,400,700,900,700italic' rel='stylesheet' type='text/css'/>

【问题讨论】:

  • 这些都不是 CSS,只是指向它的链接。
  • 是的,我的意思是请求

标签: html css performance optimization


【解决方案1】:

https://fonts.google.com/

再次在谷歌字体上重新选择你需要的所有字体。更新后的 api 将为所有组合的字体创建一个 url,如下所示:

&lt;link href="https://fonts.googleapis.com/css?family=Arvo:400,400i,700,700i|Lato:100,100i,300,300i,400|Roboto:400,500i,700,700i,900" rel="stylesheet"&gt;

您可能会考虑减少所需的字体粗细数量,因为如果您不使用它们,它们会增加不必要的负载。

【讨论】:

  • 如果我想再添加一个这样的:family=Dancing+Script:400,700 那么应该是这样的:Dancing:400,700|Script:400,700 ?
猜你喜欢
  • 2017-05-25
  • 2016-11-11
  • 2014-12-16
  • 2014-08-28
  • 1970-01-01
  • 2012-05-06
  • 2018-03-13
  • 2016-05-29
  • 1970-01-01
相关资源
最近更新 更多