DEV Community

Cover image for How to use Font Awesome in proper way
Hootan
Hootan

Posted on • Edited on

How to use Font Awesome in proper way

First go to cdnjs.com to get the library link.

in code you need one specific class named icon(or whatever) to calling icons and tag class for styling it.

.icon::before{
    display:inline-block;
    font-style:normal;
    font-variant:normal;
    text-rendering: auto;
    -webkit-font-smothing:antialiased;
    font-family: "Font Awesome 6 Free";
    font-weight: 900; 
    /* or it can be 400 */
}
Enter fullscreen mode Exit fullscreen mode

and tag's class for styling
content:"\f061";
color:white;

the \f061
is the icon character

the source site for picking the icon

Top comments (0)