How to use font-awesome icons from node-modules?

Font-awesome is a web’s icon library that gives you scalable vector icons that can be customized in terms of color, size, and in many more aspects. Many companies integrate this library icon’s on their websites. It has 600+ icons and every icon is mobile and desktop responsive irrespective of the resolution screen size. It also gives us to use animations without the use of javascript.

Syntax for Installing the library:

npm install font-awesome --save
    Approach:

  • First, we need to enter the above command in the terminal for installing the package.
  • Once the installation is fixed you can find the package inside the node-modules folder.
  • Then you need to import the file in style.css file.
  • After importing the file you can start using the font-awesome icons.

Implementation of code:

In style.css file, import font-awesome by using the following syntax.



filter_none

edit
close

play_arrow

link
brightness_4
code

@import url('../node_modules/font-awesome/css/font-awesome.min.css');

chevron_right


app.component.html :

filter_none

edit
close

play_arrow

link
brightness_4
code

<h1>Font-awesome</h1>
Notification :
<i class='fas fa-bell' style='font-size:24px'></i>
<br><br>
Message or Inbox :
<i class='fas fa-envelope' style='font-size:24px'></i>
<br><br>
Bookmark : 
<i class='fas fa-bookmark' style='font-size:24px'></i>
<br><br>
Like Button :
<i class='fas fa-thumbs-up' style='font-size:24px'></i>
<br><br>
Calendar:
<i class='fas fa-calendar-alt' style='font-size:24px'></i>

chevron_right


Output:

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.