我已经使用了 Google Fonts 中关于如何设置字体的建议。所以我做了以下操作:
1) 在页面添加了这个附件:
<link href="https://fonts.googleapis.com/css?family=Roboto:100,400,700&subset=cyrillic-ext" rel="stylesheet">
2) 将 CSS 设置为 body 标签:
html, body {
font-family: 'Roboto', sans-serif;
background: #f7f7f7;
}
当我尝试为其他元素设置字体时,例如:
a {
font-family: Roboto-Light;
}
它不起作用。
最佳答案
a {
font-family: 'Roboto'; /* You don't need this since you say html {font-family: 'Roboto'}*/
font-weight: 100;
}
/*Font's family name need to be inside quotes "MyFontName"
关于css - 如何将谷歌字体连接到页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46984673/