简体   繁体   English

如何使用 FontAwesome 向我的项目添加更多图标?

[英]How do I add more icons to my project using FontAwesome?

I'm using font-awesome in angular 10 and I've got it to work but I'd like to use some icons that I can find on https://fontawesome.com/icons but it seems like a lot of them don't work in my project.我在 angular 10 中使用 font-awesome 并且我已经让它工作了,但我想使用一些我可以在https://fontawesome.com/icons 上找到的图标,但似乎很多图标都没有在我的项目中不起作用。 I checked font-awesome.css and it doesn't have the same icons as on website.我检查了 font-awesome.css 并且它没有与网站上相同的图标。 Is there a way to add icon I need from the site to my project?有没有办法将我需要的图标从站点添加到我的项目中?

Check your Font Awesome version.检查您的 Font Awesome 版本。 You should search for icons only in this specific version.您应该仅在此特定版本中搜索图标。 If you want to use some icons of another version, remove it and add the new one.如果您想使用其他版本的某些图标,请将其删除并添加新的。

There's also a chance you are trying to use some Pro version icons.您也有可能尝试使用某些专业版图标。 If you want to use them, you should pay for a Font Awesome Pro subscription.如果您想使用它们,您应该支付 Font Awesome Pro 订阅费用。

If this doesn't help, please provide us with the code of the fontawesome installation along with some html of the icons you are trying to use.如果这没有帮助,请向我们提供 fontawesome 安装的代码以及您尝试使用的图标的一些 html。

尝试从官方网站将真棒字体下载到您的本地计算机,这对我有用。

I have found what was the problem, I didn't have all of the icons because I was using outdated package:我发现了问题所在,我没有所有的图标,因为我使用的是过时的包:

npm install font-awesome 

The newest one(i think) is the one below and it contains icons from fontawesome 5+:最新的(我认为)是下面的,它包含来自 fontawesome 5+ 的图标:

npm install --save @fortawesome/fontawesome-free

after installation i had to add in angular cli styles:安装后,我必须添加 angular cli 样式:

"./node_modules/@fortawesome/fontawesome-free/css/fontawesome.css",
"./node_modules/@fortawesome/fontawesome-free/css/solid.css",

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Fontawesome 图标未在 angular 项目中显示 - Fontawesome icons not showing in angular project 如何将自定义SVG图标添加到本地fontawesome库(fontawesome-all.js)? - How do I add a custom SVG icon to a local fontawesome library (fontawesome-all.js)? 如何将 Fontawesome 添加到 Angular 应用程序并让图标出现 - How to add Fontawesome to an Angular app and get the icons to appear 我当前的项目是使用 Angularjs 构建的,我想在同一个现有项目中的 angular 7 中添加新内容。 我怎样才能做到这一点 - My current project is build using Angularjs and i want to add new things in angular 7 in the same existing project. How can i do that 如何在角度5的kendo UI树形视图中添加自定义图标? - How do I add custom icons in kendo UI treeview in angular 5? 如何在 angular 7 上使用@fontawesome 社交网络图标? - How to use @fontawesome social network icons on angular 7? 如何在 Angular 13 中使用 fontawesome 图标 - How to use fontawesome icons in angular 13 如何在有角项目中添加星状图标? - How to add nebular icons to an angular project? 如何将已编辑的开源项目添加到自己的项目中? - How do I add an edited open-source project to my own project? 我如何在Angle中使用品牌Fontawesome图标 - How do i use brand fontawesome icon in angular
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM