我正在尝试使用 Google 网络字体作为替代字体。但它不是替代字体,而是充当主要字体。
在我的 中,我将它链接到字体:
<link href='http://fonts.googleapis.com/css?family=Balthazar' rel='stylesheet' type='text/css'>
在我的 CSS 中,我有 Copperplate 字体的变体,我知道它可以在我的 PC 上运行,并且我安装了其中的一些。这部分在我的 CSS 开头:
.class{
font-size: 24pt;
font-family: Copperplate Gothic Bold, Copperplate Gothic Light, Copperplate, Balthazar;
}
但即使 Balthazar 是最后一种字体,它也会成为第一种字体。我如何解决这个问题?
最佳答案
字体系列降级在 Google 字体的所有三种导入场景(@import
、<link>
或 JavaScript
)中似乎都能正常工作。
请看这个例子:http://jsfiddle.net/awRQm/
最可能的原因是它确实退回到 Balthazar。
对于多字字体名称,最好将它们用单引号括起来,如下所示:
.class{ font-size: 24pt; font-family: 'Copperplate Gothic Bold', 'Copperplate Gothic Light', Copperplate, Balthazar; }
根据CSS 2.1 spec :
"if a sequence of identifiers is given as a font family name, the computed value is the name converted to a string by joining all the identifiers in the sequence by single spaces"
关于html - 如何使用 Google 网络字体作为替代字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11975282/