赞
踩
今天给大家分享一个有趣的工具,写 Web 的时候常常找不到有什么字体是好看的或是要一直去找。本篇将给大家介绍一个免费的字体库,由 Google 提供的 API
首先点击去上面那个网站

将会看到有很多字体可以选择,点进去你想要的字体

然后点击 select this style,你可以一次选中多个字体,然后在代码中一次导入
接下来在右侧选择 @import 复制下面的内容到 css 如下
@import url('https://fonts.googleapis.com/css2?family=Space+Mono&family=Trispace&family=Zen+Antique+Soft&display=swap');
最后你就可以在你的 css 文件中使用想相关字体了
index.css@import url('https://fonts.googleapis.com/css2?family=Space+Mono&family=Trispace&family=Zen+Antique+Soft&display=swap');
.font1 {
font-family: 'Space Mono', monospace;
}
.font2 {
font-family: 'Trispace', sans-serif;
}
.font3 {
font-family: 'Zen Antique Soft', serif;
}

| Title | Link |
|---|---|
| Google Fonts API | https://fonts.google.com/ |
https://github.com/superfreeeee/Blog-code/tree/main/front_end/css/css_font_family_import
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。