跳至内容
欢迎 Web Awesome,最大的、最好的开源 Web 组件库。
立即预订!

入门

您需要在 Web 项目中快速添加图标吗?以下是使用 Font Awesome 在基于 Web 的项目中最快、最简单的方法(请记住,您可以使用 Font Awesome 多种其他方法,包括 在桌面版上)。

我们将介绍设置 Font Awesome 和为您的项目找到完美图标的基本知识。本视频将引导您完成以下步骤。

1. 在您的项目中设置 Font Awesome

Font Awesome 工具包是在您的项目中添加 Font Awesome 图标的最简单方法。只需创建一个新的 Font Awesome 工具包,并将工具包嵌入代码添加到您要添加图标的项目中每个模板或页面的head 部分。

2. 查找并添加图标

浏览 v6 中的数千个图标,找到您喜欢的图标,然后将图标名称和样式作为 CSS 类添加到 HTML <i> 标记中。

<body>
<!-- solid style -->
<i class="fa-solid fa-user"></i>
<!-- regular style -->
<i class="fa-regular fa-user"></i>
<!-- light style -->
<i class="fa-light fa-user"></i>
<!-- duotone style -->
<i class="fa-duotone fa-user"></i>
<!-- all new thin style -->
<i class="fa-thin fa-user"></i>
<!-- all new sharp solid style -->
<i class="fa-sharp fa-solid fa-user"></i>
<!-- all new sharp regular style -->
<i class="fa-sharp fa-regular fa-user"></i>
<!-- all new sharp light style -->
<i class="fa-sharp fa-light fa-user"></i>
<!-- all new sharp thin style -->
<i class="fa-sharp fa-thin fa-user"></i>
<!--brand icon-->
<i class="fa-brands fa-github-square"></i>
</body>

3. 使其变得出色

现在您已准备好大展身手!通过添加一些样式来提升您的项目。

查看所有样式选项

遇到问题?

仔细检查您的代码

如果您的 <i> 标记没有变成图标,请确保您已在您正在使用的页面或模板中添加了工具包嵌入代码。

获取更多帮助

查看 疑难解答部分,获取一些常见问题的答案。

使用 Font Awesome 的其他方法

正在寻找使用 Font Awesome 的其他方法吗?我们有!

使用您喜欢的语法或技术堆栈使用 Font Awesome…

还有更多!Font Awesome 可以与 Require.js带有 Turbolink 的 RailsjQuery 一起使用!