最有效的方式以及如何在您的 Web 项目中包含 google 字体?

Most performing way and how to include a google font in your web project?

如何在我的基本网络项目中包含 google 字体? 我正在使用 html、css 和 visual studio 代码中的 js 设置一个常规的 web 项目。

除此之外,最有效的方法是什么? 使用 api 还是下载字体?

亲切的问候

兄弟,方法来了。只需将此行添加到 css 文件的顶部即可。

@import url('https://fonts.googleapis.com/css2?family=Work+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

@import url('https://fonts.googleapis.com/css2?family=Work+Sans:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');

div {
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
}
<div>Hello</div>