DEV Community

Cover image for How to use font awesome icon using SVG file
Pranesh Chowdhury
Pranesh Chowdhury

Posted on • Updated on

How to use font awesome icon using SVG file

Hi, Everyone!!

Today we will know how to use Font Awesome icons without using the Font Awesome kit link.

See Here (final output) πŸ‘‡πŸ»

Demo final work

First Choose any icon from the font awesome. Then download the SVG file of the icon.
Then add the SVG file to the HTML file like this.

HTML Part:

<p>
        <img class="icon" src="images/icons/star-solid.svg" alt="">
        <img class="icon" src="images/icons/star-solid.svg" alt="">
        <img class="icon" src="images/icons/star-solid.svg" alt="">
        <img class="icon" src="images/icons/star-half-stroke-solid.svg" alt="">
        <img class="icon" src="images/icons/star-regular.svg" alt="">
    </p>
Enter fullscreen mode Exit fullscreen mode

CSS Part:

.icon{
    width: 50px;
}
Enter fullscreen mode Exit fullscreen mode

Here I added three SVG files solid, half-solid, regular (5 image) for the 3.5 star rating.

On the live website, this will show βœ…

How the live site show after html and CSS

Color Providing:

We can not set a color using the CSS. For setting a color we have to edit on the SVG file code. Here you can provide any color in the fill section. 'fill' is used for color in the SVG image.

color providing in SVG file

Now put any color in the fill="rgb(84, 246, 255)". Then the color will change.

Boom!!!!! πŸ’₯πŸ’₯πŸ’₯

Final Output

Thanks for reading πŸ’šπŸ

Top comments (0)