DEV Community

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

Posted on

How to use font awesome icon using SVG file

In this blog I will show you how to use font awesome icons without using font awesome kit link.

Like this >>>

Demo final work

First Choose any icon form the font awesome. Then download the SVG file of the icon.
Than add the SVG file on 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 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' use 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)