例如,我可以像这样进行导入:
@import url(http://fonts.googleapis.com/css?family=Roboto:100,400,900);
但是我也可以这样做吗?它有意义吗(唯一的有效值是 100、400、900)吗?
@import url(http://fonts.googleapis.com/css?family=Roboto:100,200, 300, 400,500, 600, 700, 800, 900);
最佳答案
这取决于字体。如果您在Google Fonts然后您选择一种字体。然后选择右下角的family selected
,然后单击customize
选项卡,您可以看到该字体支持的所有字体粗细。
如果支持这些字体粗细,您当前的示例正是它的外观。这是 roboto
,其中包含所有可能的字体粗细和样式。
@import url('https://fonts.googleapis.com/css?family=Roboto:100,100i,300,300i,400,400i,500,500i,700,700i,900,900i');
i
代表斜体
要使用这些字体,您需要这样做
.this-is-my-class {
font-family: 'Roboto';
font-weight:100; // or 100 - 900
font-style: italic; // or normal
}
关于css - 谷歌字体有哪些可用的字体粗细?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43037720/