我使用 Google Roboto Font在我的网站上,但我有一个小实现问题。 Google 允许我们在导入前调整字体粗细:
粗细为700的字体导入代码
@import url('https://fonts.googleapis.com/css?family=Roboto:700');
粗细为300的字体导入代码
@import url('https://fonts.googleapis.com/css?family=Roboto:300');
我的问题是,CSS 中的用法不依赖于两个导入。这意味着它总是
font-family: 'Roboto', sans-serif;
而且我无法选择要使用的 2 种导入字体中的哪一种。
最佳答案
在 CSS 方面,您必须分别应用这些规则:
font: normal 300 16px 'Roboto', sans-serif; //thin font
font: normal 700 16px 'Roboto', sans-serif; //bolder font
关于html - CSS:2 种厚度 - 1 种字体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40515940/