【发布时间】:2020-04-18 15:51:23
【问题描述】:
我正在使用 2 个 google 字体系列并将它们声明为:
<link href="https://fonts.googleapis.com/css?family=Montserrat:200,300,400,700|Roboto:300,400,700&display=swap" rel="stylesheet">
我想添加一个字体系列 (Parisienne),我只需要 & 字符 (&)。我知道这可以使用“文本”参数 (https://developers.google.com/fonts/docs/getting_started) 来完成。
但是,如果可能的话,我想将它添加到现有的链接标签中。我尝试了以下方法:
<link href="https://fonts.googleapis.com/css?family=Montserrat:200,300,400,700|Roboto:300,400,700|Parisienne&text=%26&display=swap" rel="stylesheet">
但这样做似乎将逻辑写为“加载所有 3 个字体系列,但只加载每个字体的 & 字符”。这是意料之中的,但我至少想尝试一下。我对此进行了测试,实际上每种字体中唯一有效/下载的字符是&符号
为了让它工作,我有 2 个单独的链接元素:
<link href="https://fonts.googleapis.com/css?family=Montserrat:200,300,400,700|Roboto:300,400,700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Parisienne&text=%26&display=swap" rel="stylesheet">
有没有什么方法可以只使用一个链接标签并让它加载整个 Roboto 和 Monteserrat 家族以及 Parisienne 家族的 & 字符?如果没有,那么有 2 个单独的链接标签就可以了,但如果有任何方法可以只用一个链接标签来做到这一点,那么知道如何做会很好。
【问题讨论】:
标签: html fonts google-webfonts