将此代码复制到 HTML 文档的 <head> 中:
<link href="https://fonts.googleapis.com/css?family=Archivo+Black" rel="stylesheet">
在您的 CSS 文件中,使用以下规则设置字体系列:
// if you only want to change h1 fonts, use this selector
h1 {
font-family: 'Archivo Black', sans-serif;
}
例如:
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Archivo+Black" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Playfair+Display" rel="stylesheet">
<style>
// default font for everything in the body
body {
font-family: 'Playfair Display', serif;
}
// make all h1 Archivo
// note: if you want h2, h3 etc to be archivo as well you need to add the respective selector
body h1 {
font-family: 'Archivo Black', sans-serif;
}
</style>
</head>
<body>
<div>rest of your page...</div>
</body>
</html>
在此处查看更多示例
请参阅此处以了解有关 CSS 选择器的更多信息