How to Add Font Awesome Icons in HTML


Font Awesome is a library of scalable vector icons that can be customized with color and transparency, as well as different shapes. Icons come in two formats: SVG and Icon-Font. This article outlines how to add Font Awesome icons in HTML and CSS, for both formats.

What is Font Awesome?

Font Awesome icons are vector icons that can be used in web design. They are created using the Font Awesome toolkit, which is a free and open-source toolkit. The icons are available in several formats, including SVG, AI, EPS, and PNG.

how to add font awesome icons in html

How to Add Font Awesome Icons in HTML

Font Awesome icons are a great way to add some flare to your web page or blog. They’re easy to use and there’s a huge variety to choose from. In this article, we’ll show you how to add Font Awesome icons in HTML and CSS.

In this video tutorial, you will learn everything step by step practically. I also mentioned each code that I’ve used inside the video tutorial, So, hope you will get many new ideas from it.

First of All, you need to make a file like index.html then you need to add the basic structure of the HTML, then you need to add font awesome CD file inside the HTML document.

Once you get the file and add it to the HTML document, then you will be able to use Font Awesome on your project.

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="css/all.min.css" />
    <title>How to Use Font Awesome Icon in HTML and CSS3</title>

    <!-- Display FontAwesome Icon -->
    <i class="fas fa-camera"></i>


Once you complete the above procedure, then you can add the font awesome icons to your project. I’ve mentioned the font awesome icon inside the I tag, you can check it.

    <i class="fas fa-bell"></i>
    <i class="far fa-bell"></i>

Inside the above code have two icons, you can see the bell icons but inside the first one will see the bell with the background and the second one without the background.

    <!-- Sizing fontawesome -->
    <i class="fas fa-bell fa-xs"></i>
    <i class="fas fa-bell fa-sm"></i>
    <i class="fas fa-bell fa-lg"></i>
    <i class="fas fa-bell fa-3x"></i>
    <i class="fas fa-bell fa-6x"></i>
    <i class="fas fa-bell fa-10x"></i>

If you want to increase the font awesome icons size, you can add the classes after the particular icon name, I’ve mentioned the above codes, and inside the codes, you can find different sizes with different classes.

<!-- Animated Icons -->
    <!-- <i class="fas fa-sync-alt fa-spin fa-3x"></i>
    <i class="fas fa-spinner fa-pulse fa-3x"></i>

When you need to animate the icons, you can do that I’ve mentioned the above codes and also classes that help you to animate the icons such as loaders.

    <ul class="fa-ul">
        <span class="fa-li"><i class="fas fa-check-square"></i></span>Item
        <span class="fa-li"><i class="fas fa-spinner fa-pulse"></i></span>Item

If you want to add the font awesome icons inside the list item, you can use above mentioned codes to display the icons inside the list item.

    <!-- <i class="fas fa-car fa-rotate-90"></i>
    <i class="fas fa-car fa-rotate-180"></i>
    <i class="fas fa-car fa-rotate-270"></i>
    <br />
    <i class="fas fa-car fa-flip-horizontal"></i>
    <i class="fas fa-car fa-flip-vertical"></i> -->

That’s last thing, When you will rotate the icons on your project, you can use the above-mentioned code to rotate the font awesome icons.

How to Add Font Awesome icons in CSS

Hey Guys, I’ve shared each code which use to display the font awesome icons inside the HTML document using classes. But, you can use the manual classes inside the HTML document to display the font awesome icons.

    <span class="twitter">Twitter</span>
    <span class="facebook">Facebook</span>
    <span class="youtube">YouTube</span>

Once you use the above-mentioned codes, then you need to use CSS to manage it. I’m going to share with you the codes below.

 .twitter::before {
        content: "\f099";
        font-family: "FontAwesome";
        font-weight: 400;
      .facebook::before {
        content: "\f09a";
        font-family: "FontAwesome";
        font-weight: 400;
      .youtube::before {
        content: "\f167";
        font-family: "FontAwesome";
        font-weight: 400;
        color: red;


We hope this article has helped you understand how to add Font Awesome icons in HTML. If you have any further questions, please feel free to post them in the comments below.

You May Also Like:

If you like that please share it on social sharing websites have a nice day.

Previous articleInventory Management System in PHP
Next articleFree Source Code Projects in Php
I'm Programmer, Digital Marketer, and Blogger, I have been working on the web for 04 years. Basically, I have been sharing personal expertise on my website.


Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.